Text Switcher
Flip between two prompts, keep the shared bit
- text
- alt_text
The class name is a mouthful - TextWithBooleanSwitchAndCommonTextInput - but the menu just calls it Text Switcher, and its job is small and useful. It picks between two chunks of text with one toggle, and automatically staples a shared "common" chunk onto whichever you chose. Think of it as an A/B prompt switch that keeps your quality tags attached no matter which side wins.
This is a prompt-building convenience. In practice you're constantly reusing the same boilerplate - a quality preamble, a set of trigger words, a style tag block - while swapping the content part. Rather than paste that boilerplate into both variants and keep them in sync, you put it once in common_text and let the node join it to text1 or text2. Change the shared part in one place and both branches update.
How it works
A boolean, use_text2, chooses the branch: off gives you text1, on gives you text2. The node then combines that with common_text, and a second toggle, common_text_at_front, decides whether the shared text goes before or after the chosen text. So you can build "masterpiece, best quality, " + your prompt or your prompt + ", <lora trigger>" depending on where the boilerplate belongs.
The inputs that matter
- use_text2 (
BOOLEAN) - the switch. Off = text1 (the default), on = text2. - text1 - your default prompt content.
- text2 - the alternative, used when the switch is on.
- common_text - the shared chunk joined onto whichever branch is active. Leave it blank if you don't need one.
- common_text_at_front (
BOOLEAN) - puts the common text before the chosen text when on, after it when off.
The outputs
- text - the combined result for the active branch.
- alt_text - the combined result for the other branch. Handy when you want both versions available at once - say, feeding the two into different samplers or into a comparison.
Installing it
Install the pack. ComfyUI Manager: Manager -> Custom Nodes Manager, search ComfyUI_Mira, Install, restart. Or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/mirabarukaso/ComfyUI_Mira.git
Restart, and on a load error run pip install -r requirements.txt inside the folder before restarting. No models.
Common issues
The most common surprise is a stray comma or missing space at the join. The node concatenates; it doesn't clean up punctuation. If you want "tag1, tag2" and not "tag1tag2", put the trailing comma-and-space on your text yourself - end common_text with , or start it that way depending on which side it lands. Prompt tags are comma-delimited, so the separator hygiene is on you.
The other thing: use_text2 off means text1, which is the opposite of what some people assume from the name. It defaults to false, so out of the box you get text1 + common. Flip it deliberately.
This is one of several text-wrangling nodes in ComfyUI_Mira, mirabarukaso's personal utility pack (they're the WAI Character Select dev). If you need to reorder several prompt blocks rather than pick between two, look at the Text Switcher Two Ways / Three Ways nodes; if you want to slice one wildcard line into pieces, that's Text Wildcard Seprator.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| use_text2 | BOOLEAN | false | — |
| common_text_at_front | BOOLEAN | false | — |
| text1 | STRING | — | |
| text2 | STRING | — | |
| common_text | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| alt_text | STRING | — |