πͺ Switch string
Switch String (Crystools)
- string
The STRING member of Crystools' switch family, with one small but real difference from its siblings: both on_true and on_false default to an empty string, where the image and conditioning switches have no default at all for their typed inputs. Practically, that means this node will still run with both sides left blank - it just outputs empty string - instead of erroring out for missing required data the way the others do.
Why you'd reach for it
Swap between two text values with a single boolean: two prompt variants, two filename patterns, a debug label that flips based on some condition elsewhere in your graph. It pairs naturally with Primitive boolean as the toggle and Primitive string or Primitive string multiline for the two candidate values, giving you a fully visible, editable A/B setup for text.
It's also a clean way to build a "test mode" into a workflow you share with someone else - wire a short debug string into on_true and your real value into on_false, hand off the graph with one obvious boolean they can flip, and they don't need to understand your whole prompt-building setup to safely try both.
How it works
Same lazy-evaluation behavior as the rest of the switch family - since a 2025 release, only the branch actually selected by the boolean gets its upstream chain executed, so building the unused text path (even something as cheap as a string concat) still doesn't cost you anything you didn't ask for.
Inputs and outputs
Required: on_true and on_false (both STRING, default empty) and boolean (default true, routes on_true). Output: string.
Installing it
Nothing extra beyond the base pack install - the switch family, primitives, and debug nodes all come in together. Through ComfyUI Manager, search crystools. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/crystian/ComfyUI-Crystools.git
cd ComfyUI-Crystools
pip install -r requirements.txt
Restart ComfyUI. No models or extra dependencies for this node.
Common issues
Because both branches default to empty string, a genuinely blank output is easy to mistake for "the switch is broken" when the real cause is just that you left one side unconnected and never noticed - check that both on_true and on_false are actually wired to something (or have real text typed in) before assuming there's a bug. Beyond that mix-up, this is one of the more reliable nodes in the pack - there's no type ambiguity to worry about, since everything on both sides is plain text, unlike the image or conditioning switches where a type mismatch can happen without ComfyUI's link validation catching it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| on_true | STRING | β | |
| on_false | STRING | β | |
| boolean | BOOLEAN | true | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | β |