Text Switch
An On/Off Valve for Anything You Wire Through It
- string
Text Switch is one of those nodes that's so boring you almost skip it - and then you realize how often you needed it. It takes a string, and a boolean toggle, and does one thing: switch on, the string passes through; switch off, you get an empty string. That's the entire feature set, and it's genuinely useful because "empty string" and "delete this from the workflow" are not the same thing in a node graph.
Why you'd want that
The obvious home for it is prompt building. Say your positive prompt is a concatenation of a base prompt and a style fragment. Put the style fragment behind a Text Switch, flip the switch off, and the fragment becomes an empty string that concatenation quietly swallows - your base prompt still flows, nothing is deleted, and you can flip it back on for the next run. It's the poor-man's per-node bypass, and for text it beats deleting and re-adding nodes all afternoon.
The switch also earns its keep for A/B testing a translated vs. raw prompt, or for keeping a workflow that must run without you fiddling with it. You build the plumbing once, then just flip booleans at run time.
The inputs, and the one that trips people
- switch - a boolean, on by default. On sends the text through; off outputs
"". - text - the string input. Here's the trap: it's declared with
forceInput, meaning you cannot type into it. It must be wired from another node's output. ATextnode from this same pack, your translation node, a concatenation - whatever. People sit there clicking the empty field wondering why nothing happens, and the answer is that the field was never meant to be typed into.
The single output is a string, ready to feed a CLIP Text Encode or another text node further down the chain.
Installing
It ships in the pictorialink/ComfyUI-Text-Translation pack alongside the translation nodes. ComfyUI Manager: search ComfyUI-Text-Translation and install. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/pictorialink/ComfyUI-Text-Translation
cd ComfyUI-Text-Translation
pip install -r requirements.txt
Restart ComfyUI. The only real dependency is the translators library - no models, no API keys. If you're upgrading from a version older than May 2024, remove the old folder first; the pack was rewritten since and isn't backward compatible.
There isn't much to troubleshoot here, which is the point. If a switch-off output isn't behaving like "nothing," check what you're connecting it into - some nodes treat an empty string differently from a disconnected wire. The node itself is doing exactly what the boolean says.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| switch | BOOLEAN | true | — |
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |