Lazy Switch (Text)
Pick between two prompt strings based on a mode
- STRING
Lazy Switch (Text) is the string-flavored member of the Vsaan212 switch family: compare a text value to a match string, and output one of two text blocks depending on the result. Where the float and integer versions route numbers, this one routes words - which makes it the natural choice for picking between prompt fragments, negative-prompt sets, or system strings when a workflow changes mode.
Same DNA as its numeric siblings. The matching is trimmed and case-insensitive by default, match accepts comma- or pipe-separated alternatives, and the unused branch is lazy-skipped so ComfyUI never executes the prompt-engineering node you didn't pick. The one difference that matters is that on_true and on_false are full multiline text boxes - you can paste a proper paragraph into each, not just a token.
How it works
You wire compare to whatever text is steering the graph - typically a mode string like R2V, or a selector output. Set match to the value (or values, comma/piped) you're looking for. If compare matches, you get on_true; otherwise on_false. Default comparison trims whitespace and ignores case, so " i2v " cleanly matches "I2V"; flip case_sensitive only when you're matching something where case is actually meaningful.
The lazy evaluation is the quiet win. Each branch input declares itself lazy, and the node reports which one it needs before execution - so when compare is T2V and on_true is wired to a whole LoRA-stacking text pipeline, that pipeline is never computed. On a graph where the losing branch would burn seconds, this is the difference between a snappy toggle and a workflow that recomputes everything every time.
Inputs and output:
compare- the upstream text to test (usually a mode / selector string).match- whatcomparemust equal;,or|for alternatives.on_true- multiline text returned on a match.on_false- multiline text returned otherwise.case_sensitive- off by default.
Output is a single STRING.
Where it earns its keep
Two classic patterns. First, mode-appropriate prompt tails: in R2V mode you want a "follow the reference" style suffix, in T2V you want an establishing-shot style - one switch, no manual copy-paste when you flip modes. Second, gating a negative prompt or an override fragment so it only applies in the mode it was written for.
It's a niche tool outside a mode-switching stack. If you just need one of two fixed strings and nothing drives the choice, an rgthree-style selector or a manual bypass is simpler. But as part of the Vsaan212 automation loop, where a single global dropdown determines the whole graph's behavior, this is how you make text follow along automatically.
Installing it
It ships in vsaan212/Vsaan212-workflow-utilities (MIT). Install from ComfyUI Manager by searching Vsaan212-workflow-utilities, or:
cd ComfyUI/custom_nodes
git clone https://github.com/vsaan212/Vsaan212-workflow-utilities
Restart ComfyUI and look under vsaan212/utilities. No models, no API keys, no extra dependencies for this node. One caveat worth repeating from its siblings: feed compare a bare mode string. A multi-line tagged blob from the automation node won't match match directly - resolve it to T2V/I2V/FL2V/R2V first.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| compare | STRING | Upstream text to test (e.g. selector / mode string). | |
| match | STRING | When compare equals this, output on_true; otherwise on_false. Use commas or pipes for alternatives (e.g. t2v,r2v). | |
| on_true | STRING | Value when compare matches match. | |
| on_false | STRING | Value when compare does not match. | |
| case_sensitive | BOOLEAN | false | When off, compare and match are trimmed and compared case-insensitively. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |