Text Index Switch (YC)
Pick one of 12 prompts with an index — and only compute that one
- text
A/B testing prompts in ComfyUI usually means manually swapping which text box is connected, re-running, swapping again. YC-Text-Index-Switch turns that into a slider. It takes twelve text inputs - text0 through text11 - and outputs whichever one your index input points at. Change the index, re-run, done. It's the kind of tiny quality-of-life node that looks trivial and quietly saves you an hour a week.
How it works
The node is a classic multiplexer with one upgrade worth knowing about: it's lazy. Rather than force every connected text input to compute on every run (which can matter when those inputs come from expensive nodes like a prompt-generation or tokenizer), it implements check_lazy_status so ComfyUI only evaluates the input that the current index actually references. Unreferenced inputs stay dormant. That's the sort of efficiency detail most switch nodes skip, and it's the reason this one feels fast in big graphs.
The index range is 0–11 (12 slots, matching text0–text11). If the indexed input isn't connected, it returns an empty string rather than erroring - which is friendly but also means a typo in your wiring silently gives you a blank prompt and a confusing image. The index itself is just an INT, so it can come from a slider, a batch index, another switch, or a formula.
The inputs that matter
- index - 0–11, which input to pass through.
- text0 … text11 - the twelve candidate strings. All optional; connect only what you need.
Output is text, a single STRING, ready for any text prompt, CLIP text encode, or filename field.
When it's genuinely useful
Beyond A/B prompt testing, it's the building block for prompt rotation: pair it with a seed or counter node and you can cycle through twelve prompts automatically across runs, giving you cheap variety without touching the graph. It also plays well with batch processing where each batch item maps to a different prompt slot, or as a manual override panel when you want to keep one node as the "which prompt is active" control for a workflow you share with someone.
Installing it
Part of ComfyUI-YCNodes. Install via ComfyUI Manager (search ComfyUI-YCNodes), or:
cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes
Restart, then look under YCNode/Logic. No dependencies beyond the Python standard library - it's pure logic.
Gotchas
Two things to remember. First, the slot numbering is zero-based and there are twelve slots; the schema caps index at 11, so don't reach for slot 12. Second, the empty-string-on-missing-input behavior: if you think the switch is broken because you're getting blank prompts, you've almost certainly connected text5 but indexed 6, or left the target unconnected. Also worth knowing: unlike the pack's ImageBatchSelector, this indexes slots, not names - there's no naming, just positions, so keep the mapping written down or a note node nearby.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| index | INT | 00–11 | — |
| text0opt | STRING | — | |
| text1opt | STRING | — | |
| text2opt | STRING | — | |
| text3opt | STRING | — | |
| text4opt | STRING | — | |
| text5opt | STRING | — | |
| text6opt | STRING | — | |
| text7opt | STRING | — | |
| text8opt | STRING | — | |
| text9opt | STRING | — | |
| text10opt | STRING | — | |
| text11opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |