Text Prompt Switch
The unglamorous text switch that makes prompts a switchboard
- text
TextPromptSwitch is the least impressive node in this pack, and the one you'll actually use the most. It does exactly one thing: it appends a block of text to a prompt string when a boolean is on, and passes the string through untouched when it's off. That's it. No LoRA loading, no model wiring, no clip. Just a gate on a string.
Why you'd reach for it
If you build one workflow you reuse - a character, a scene, a style, a batch of negative boilerplate - you end up editing the CLIP Text Encode every time you want to swap something. This node lets you split your prompt into togglable blocks instead: one TextPromptSwitch per variation, all chained into a single prompt string. Flip a switch, keep the seed, and you can A/B two descriptions without touching a text box. It's the same "switch" idea the pack applies to LoRAs, minus the LoRA. If you've ever wished ComfyUI's mute was a first-class prompt widget, this is that.
Chain several together and the picture gets clearer: a base prompt, plus switchable blocks for background, subject detail, or negative tags. One master workflow that covers a handful of scenarios instead of a folder of near-identical JSON files. That's the entire value proposition, and it's enough.
How it works
The mechanism is trivial by design. With enable on, the node joins your incoming input_text and the text field with a comma and - this is the part to know - always leaves a trailing comma on the result. That trailing comma is what makes chaining work: each node in the chain appends cleanly without you babysitting separators. When enable is off, the input string comes back untouched.
Inputs: enable (the toggle), text (the block to append), and an optional input_text for chaining. Output: a single text string, which you'd normally feed into the prompt input of a CLIP Text Encode node.
The node also declares separator and trailing_separator inputs, but the pack hides them in the UI and the current code ignores them entirely - they're kept around so workflows saved by older versions still load. The comma behavior is hardcoded, so don't go looking for a way to change it.
Installing
It ships in the same pack as LoRA Prompt Switch, so install that once: search comfyui-lora-prompt-switch in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/sstoye/comfyui-lora-prompt-switch
Restart ComfyUI and it appears under text. No pip install, no dependencies beyond ComfyUI itself, no model files. The node tints green when enabled and red when off, which is a small but genuinely nice touch when you've got a wall of them.
The one thing to know
The toggle lives on the node, not in the text - so if you have a bunch of these chained and your prompt looks wrong, check the little colored nodes first, not the prompt box. And if you wire enable to something that feeds a workflow-wide boolean (or just an input you can drive from another node), you get prompt switching that's actually scriptable rather than click-per-render. For a node this thin, that's about as good as it gets.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| enable | BOOLEAN | true | — |
| text | STRING | — | |
| input_textopt | STRING | — | |
| separatoropt | STRING | , | — |
| trailing_separatoropt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |