Text Switch Stack
One prompt, up to 32 toggled parts — Text Switch Stack
- STRING
Text Switch Stack answers the eternal workflow question "how do I turn one part of my prompt off without deleting it?" instead of the other classic - "which of these prompts do I pick?" - and that distinction is the whole thing. Where rgthree's Text Switch selects one input out of many, this node takes up to 32 text slots, lets you tick each one on or off, and merges the enabled ones into a single string. Build your prompt out of swappable chunks - subject, style, lighting, quality tags - and A/B test by flipping booleans instead of retyping prompts.
How it works is refreshingly legible. Each slot has an enabled_ toggle and a part_ text box (multiline, so multi-line blocks are fine). On execution it walks the slots in order, skips any that are disabled or empty, and joins what's left. The merge isn't a comma-space join, which catches people out: parts are joined with newlines, and the auto_comma option (on by default) appends a trailing English comma to every part except the last - only when the part doesn't already end in one. So the default output for three parts is:
subject,
style,
quality tags
If that trailing-comma-then-newline style annoys you - and plenty of people expect ", " - flip auto_comma off and write your own separators into the parts. There's no separator setting, so that's the trade.
The inputs that matter:
- text_count - how many slots show up, from 1 to 32. This controls how many are processed, and it's where the trap lives: lower it to 2 when your text is sitting in part 3, and part 3 silently stops counting. The node's own front-end JS hides the widgets beyond the count so you can watch it happen.
- auto_comma - the trailing-comma behavior above.
- enabled_N / part_N - one pair per slot; only enabled, non-empty parts reach the output.
Output is a single STRING, ready for a positive prompt input, a text-encode node, or a CLIP conditioning.
Install is the pack's standard trivial route. ComfyUI Manager, search comfyui-uonr-nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/uonr/comfyui-uonr-nodes
Restart ComfyUI. No dependencies, no models - this is a pure-front-end-plus-one-function node. Worth knowing the dynamic slot behavior relies on the default LiteGraph front end; in the stock UI it collapses and expands as you change text_count, which is the nicest part of the experience.
Realistic gripes: because enabled and part are fixed widget pairs, you can't wire a slot from another node's string output - it's typing or pasting only. And with the newline join plus auto-comma, you should test one output before trusting a 32-slot monster into a workflow. But for the common case - a handful of prompt chunks you keep swapping - it beats juggling a dozen Muted node groups, and that's a real win.
Inputs (66)
| Name | Type | Default | Description |
|---|---|---|---|
| auto_comma | BOOLEAN | true | Append an English comma to every enabled part except the last one when needed. |
| text_count | COMBO | 1 | Number of text slots to show and process. |
| enabled_1opt | BOOLEAN | true | Include text 1 in the merged output. |
| part_1opt | STRING | Text part 1. | |
| enabled_2opt | BOOLEAN | true | Include text 2 in the merged output. |
| part_2opt | STRING | Text part 2. | |
| enabled_3opt | BOOLEAN | true | Include text 3 in the merged output. |
| part_3opt | STRING | Text part 3. | |
| enabled_4opt | BOOLEAN | true | Include text 4 in the merged output. |
| part_4opt | STRING | Text part 4. | |
| enabled_5opt | BOOLEAN | true | Include text 5 in the merged output. |
| part_5opt | STRING | Text part 5. | |
| enabled_6opt | BOOLEAN | true | Include text 6 in the merged output. |
| part_6opt | STRING | Text part 6. | |
| enabled_7opt | BOOLEAN | true | Include text 7 in the merged output. |
| part_7opt | STRING | Text part 7. | |
| enabled_8opt | BOOLEAN | true | Include text 8 in the merged output. |
| part_8opt | STRING | Text part 8. | |
| enabled_9opt | BOOLEAN | true | Include text 9 in the merged output. |
| part_9opt | STRING | Text part 9. | |
| enabled_10opt | BOOLEAN | true | Include text 10 in the merged output. |
| part_10opt | STRING | Text part 10. | |
| enabled_11opt | BOOLEAN | true | Include text 11 in the merged output. |
| part_11opt | STRING | Text part 11. | |
| enabled_12opt | BOOLEAN | true | Include text 12 in the merged output. |
| part_12opt | STRING | Text part 12. | |
| enabled_13opt | BOOLEAN | true | Include text 13 in the merged output. |
| part_13opt | STRING | Text part 13. | |
| enabled_14opt | BOOLEAN | true | Include text 14 in the merged output. |
| part_14opt | STRING | Text part 14. | |
| enabled_15opt | BOOLEAN | true | Include text 15 in the merged output. |
| part_15opt | STRING | Text part 15. | |
| enabled_16opt | BOOLEAN | true | Include text 16 in the merged output. |
| part_16opt | STRING | Text part 16. | |
| enabled_17opt | BOOLEAN | true | Include text 17 in the merged output. |
| part_17opt | STRING | Text part 17. | |
| enabled_18opt | BOOLEAN | true | Include text 18 in the merged output. |
| part_18opt | STRING | Text part 18. | |
| enabled_19opt | BOOLEAN | true | Include text 19 in the merged output. |
| part_19opt | STRING | Text part 19. | |
| enabled_20opt | BOOLEAN | true | Include text 20 in the merged output. |
| part_20opt | STRING | Text part 20. | |
| enabled_21opt | BOOLEAN | true | Include text 21 in the merged output. |
| part_21opt | STRING | Text part 21. | |
| enabled_22opt | BOOLEAN | true | Include text 22 in the merged output. |
| part_22opt | STRING | Text part 22. | |
| enabled_23opt | BOOLEAN | true | Include text 23 in the merged output. |
| part_23opt | STRING | Text part 23. | |
| enabled_24opt | BOOLEAN | true | Include text 24 in the merged output. |
| part_24opt | STRING | Text part 24. | |
| enabled_25opt | BOOLEAN | true | Include text 25 in the merged output. |
| part_25opt | STRING | Text part 25. | |
| enabled_26opt | BOOLEAN | true | Include text 26 in the merged output. |
| part_26opt | STRING | Text part 26. | |
| enabled_27opt | BOOLEAN | true | Include text 27 in the merged output. |
| part_27opt | STRING | Text part 27. | |
| enabled_28opt | BOOLEAN | true | Include text 28 in the merged output. |
| part_28opt | STRING | Text part 28. | |
| enabled_29opt | BOOLEAN | true | Include text 29 in the merged output. |
| part_29opt | STRING | Text part 29. | |
| enabled_30opt | BOOLEAN | true | Include text 30 in the merged output. |
| part_30opt | STRING | Text part 30. | |
| enabled_31opt | BOOLEAN | true | Include text 31 in the merged output. |
| part_31opt | STRING | Text part 31. | |
| enabled_32opt | BOOLEAN | true | Include text 32 in the merged output. |
| part_32opt | STRING | Text part 32. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | All enabled text slots merged into one string. |