Switch Text
The cheapest prompt A/B switch in ComfyUI
- text
Sometimes you don't want to rebuild a workflow to try a different prompt - you want a valve. Switch Text is exactly that: one boolean, two strings, one output. Flip the toggle and the other string comes out the other side. It's the minimal A/B switch for prompt testing, and for what it is, it's perfect.
What it does
Two text options in, a boolean switch in the middle, one string out. Off returns option1; on returns option2. The author's tooltip spells out the direction explicitly: "The option that will returned if the switch is off/false" for option1, "if the switch is on/true" for option2.
The uses write themselves. Toggle between two style variants of a prompt and compare outputs side by side without touching the text. Route between two negative-prompt strategies by flipping a switch instead of editing. Chain a couple together to cycle through prompt combinations. If you've ever wanted rgthree-style switchers but only need a single string toggled, this is the stripped-down version that does the one job.
How it works
It's a one-line conditional - option1 if not switch else option2 - and that's the whole mechanism. No evaluation, no merging, no surprises. The switch is a proper BOOLEAN, so beyond clicking the toggle you can also wire it from another node that outputs a bool, which is how you'd automate the choice mid-workflow.
Inputs:
- option1 (STRING) - returned when the switch is off.
- option2 (STRING) - returned when the switch is on.
- switch (BOOLEAN, default off).
Output: text - whichever option the switch selected.
How to install it
From exectails/comfyui-et_stringutils ("String Utils"). ComfyUI Manager → search "String Utils", or:
cd ComfyUI/custom_nodes
git clone https://github.com/exectails/comfyui-et_stringutils
Restart, and it's under exectails/Strings. No dependencies, no model downloads - pure Python, install is as safe as this ecosystem gets.
Common issues
The failure modes are all human error:
- Wiring it backwards. The off/on direction is easy to forget - off gives option1, on gives option2. If your A/B test comes back swapped, you didn't build the switch wrong, you flipped the convention.
- Expecting more than two states. It's a binary valve, not a router. Want to choose between three strings? Stack two switches, or use a different tool entirely.
- Typing vs wiring. Unlike the pack's formatter args,
option1andoption2are plain typeable text boxes - no forceInput, no need for Primitive nodes. You can just type your two variants and go.
For comparing two prompt strings quickly, nothing in this pack is faster to drop in. It's boring, it's transparent, and that's precisely why it works.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| option1 | STRING | The option that will returned if the switch is off/false. | |
| option2 | STRING | The option that will returned if the switch is on/true. | |
| switch | BOOLEAN | false | The switch that determines which option to return. Option 1 if off, option 2 if on. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |