Text Switch 2 Input With Text Output
Two text inputs, one pick — selected by a label you actually remember
- text
TextSwitch2InputWithTextOutput is the two-option text switch you didn't know you wanted until you wanted it. You feed it two strings, it hands back exactly one of them, and - this is the part that distinguishes it - you select which one by matching a custom label, not by index and not by the text itself.
The practical upshot: your inputs can be "a cinematic portrait" and "a stark documentary shot", and instead of remembering that option 1 is the cinematic one, you label them Cinematic and Stark, then drive the switch with those words. The node reads like the workflow's intent instead of its plumbing.
How it works
Trivial and transparent. Each run compares the choose string against label_a and label_b. Match on label_a → output text_a. Match on label_b → output text_b. Match on neither → output an empty string. There's no index arithmetic to get backwards, no "which of these twenty was it" - just a string comparison.
That third case is worth calling out because it's a feature, not a bug. With the default choose of None, an unconnected node returns an empty string, which makes it a clean conditional: wire it into a prompt concat and you get "nothing added" rather than a stray default. It's the same "or none" trick the node's description advertises.
The inputs that matter
- text_a / text_b - the two options. Both are
forceInputsockets, so they come from other nodes (prompts, text switches, anything emitting STRING). - label_a / label_b - the names you pick from. Defaults are the uninspiring
Text A/Text B; rename them to something meaningful and the node becomes self-documenting. - choose - the selector. A plain string widget (not a dropdown): type
Cinematicto get text_a,Starkfor text_b.
One output: text - the chosen string, or "" if choose matches neither label.
Where it fits
Prompt A/B testing is the obvious home: two positive prompts, two negative prompts, or a "detailed vs. minimal" variant, with choose driven from an AUN Boolean or Single Label Switch so one toggle flips the whole style. Pair it with a text concat and the "neither" case makes it a clean conditional injector. It's a smaller sibling of AUN's Text Index Switch family - those handle many inputs by number; this one handles two by name, which is often all you need.
The gotcha
choose is an exact string match. Case matters, trailing spaces matter, and a typo silently falls through to the empty-string branch - you'll get a blank prompt and wonder what broke. If you're driving choose from another node, make sure whatever emits it outputs exactly one of your labels. When in doubt, check the node with a Show Text on the output.
Also note the AUN compact-mode habit applies here: double-click the node body to hide the config widgets and keep the canvas tidy.
Installing it
AUN pack, same as every node in this collection. ComfyUI-Manager → search "AUN" → install, or:
cd custom_nodes
git clone https://github.com/loz2754/AUN-ComfyUI-Nodes
Restart ComfyUI. This node is pure string logic - it needs nothing beyond the pack's own Python, though Manager will pull the shared deps (piexif, opencv-python-headless, imageio-ffmpeg, requests) for the image/video nodes anyway. Cloned manually and hit a missing-module error? pip install -r custom_nodes/AUN-ComfyUI-Nodes/requirements.txt.
Small, boring, and exactly the kind of node that makes a workflow read well.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text_a | STRING | First text option. | |
| text_b | STRING | Second text option. | |
| label_a | STRING | Text A | Label used to select text_a. |
| label_b | STRING | Text B | Label used to select text_b. |
| choose | STRING | None | Which label to output. Set to label_a to output text_a, label_b to output text_b, otherwise outputs empty. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |