DP 3 String Switch Or Connect
Pick one of three prompts, or glue them together
- TEXT
- CURRENT_INDEX
This is the two-jobs-in-one text node. Feed it up to three strings and it'll either pass exactly one of them through (switch), or stitch all of them into a single string (connect) with a joiner you choose. That "or" in the name is the whole point - most switch nodes only switch, this one also does the concatenation you'd otherwise reach for a second node to do.
It's part of the Desert Pixel pack, a large collection of quality-of-life nodes. Like rgthree's utilities, nothing here generates an image; it just makes wiring text through a graph less tedious. Think of this as building blocks for a prompt: three fragments you can either select between or assemble.
How it works
Two dials drive it. mode decides whether you're switching or connecting, and index decides which input matters when you're switching.
The mode dropdown has five options:
- Switch - output only the one string at
index. - Connected - join all the connected strings back to back.
- Connected with comma - join them with
,between, the usual prompt separator. - Connected with line break - join them one per line.
- Connected with line break+ - join with extra line spacing.
So the same node is a selector when you set mode to Switch, and a prompt assembler when you set it to any of the Connected modes. Comma-join is the one you'll use most for stacking prompt chunks; the line-break modes are handy for things that expect one entry per line, like some scheduling and travel formats.
The inputs and outputs that matter
mode- switch vs. one of the four connect styles (above).index- an integer from 1 to 3. Only used in Switch mode; it points atString_01,String_02, orString_03.String_01,String_02,String_03- optional multiline inputs. Because they're optional you can leave gaps; connect only the ones you need.
Outputs are TEXT (the result string) and CURRENT_INDEX (an integer). That second output is more useful than it looks - in Switch mode it tells you which input was chosen, so if you're driving index from a counter to cycle through options, you can log or display exactly where you are.
Need more slots? The 5-input and 10-input versions are identical in spirit with more strings (the 10-input one even adds a mode that strips negative text). Three is the sweet spot when you've got a subject, a style, and a quality tail to juggle.
How to install it
- ComfyUI Manager: search "Desert Pixel", install, restart. Nothing to download.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes,pip install -r requirements.txtif present, restart.
Find it under the DP category in the node browser.
Common issues
The classic confusion is setting mode to a Connected option and then wondering why index does nothing. It's supposed to do nothing there - index only bites in Switch mode. In the connect modes every wired string is used regardless of index.
The other gotcha is empty inputs. If a string slot is left unconnected, it contributes nothing to a connect, which is usually what you want, but it also means a Switch pointed at an empty slot outputs an empty string. If your prompt suddenly went blank, check that index is pointing at a slot you actually filled.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | Switch | 5 options: Switch, Connected, Connected with comma, Connected with line break, Connected with line break+ |
| index | INT | 11–3 | — |
| String_01opt | STRING | — | |
| String_02opt | STRING | — | |
| String_03opt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| TEXT | STRING | — |
| CURRENT_INDEX | INT | — |