String Switch
Flip a checkbox instead of rewriting your prompt twice
- STRING
You've built the workflow with two versions of the same prompt in it - the one with the lighting tag and the one without - and every comparison run means deleting a node, rewiring a link, and hoping you put it back the same way. That's what switches are for. A switch is the cheapest piece of graph programming there is: pick one of two things, let the rest of the graph stay untouched.
String Switch is the string-shaped version. Checkbox on, you get the first string. Checkbox off, you get the second. That's the entire node.
The shape of it, and why the shape matters
There are two things people mean when they say "switch" in ComfyUI, and confusing them is how sessions get lost. An A/B switch has a selector - a boolean or an index - and passes whichever input you point it at. It's a valve you operate. A fallback switch has no selector at all; it walks its inputs and passes the first one that isn't empty, so the graph decides which branch is live.
String Switch is squarely the first kind. You decide. Nothing about the output depends on whether some upstream node happened to produce text - if you say True, the True string comes out, even if it's blank. That predictability is the point, and also the trap: an A/B switch has no opinion, so it will cheerfully pass an empty string downstream and leave you wondering why the image ignored your prompt.
Inputs and output
switch is a BOOLEAN, defaulting to on. true_switch_string is what comes out when it's on, false_switch_string when it's off. Both are single-line text widgets, both default to empty. The output is one STRING - "the selected string" - which goes wherever a prompt or a tag or a filename needs to go.
The checkbox is a BOOLEAN-typed input, so it can be driven by data: right-click → Convert widget to input, then wire a core PrimitiveBoolean, or the pack's own Is Empty, which takes any type and emits a BOOLEAN. Is Empty → String Switch gives you an automatic "if the prompt node returned nothing, use my fallback" valve, with the decision visible on the canvas.
Both string boxes are widgets, but either can be converted to an input - that's how you feed them from two CLIP Text Encodes or two prompt files.
The thing that surprises people
The two strings are single-line. Paste a full prompt with line breaks into one and you get a horizontal scroller the width of a bus, and good luck proofreading it.
Which is why my actual recommendation is: if the strings you're switching between are prompts, use the pack's sibling instead - String Switch (Multiline), same inputs, same behaviour, same category, multi-line boxes. Install once, get both. This one is genuinely better for one-liners; it's just the wrong tool for a 40-token prompt.
Second surprise: this switches text, not compute. Flipping it doesn't mute the branch you didn't pick - if both boxes are wired to different encoding chains, both still run on every queue. You're choosing which string arrives downstream. Skipping work is group muting, which is a different feature.
Where it earns its place
Model testing, mostly. The pack was built for its author's "Ultimate Model Tester" workflow, and this is exactly what that workflow needs: one base composition, one checkbox toggling between two prompt styles or two trigger tokens, a batch of queued runs that each flip it once. Same graph, comparable outputs, no rewiring between runs.
It's also handy for the boring stuff: filename suffixes, two negative-prompt phrasings, a manual override for a bad auto-caption.
Installing it
ComfyUI Manager: search ComfyUI-MDSNodes (publisher marwandsai) and install. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MarwanDSAI/comfyui-mdsnodes
Restart ComfyUI, hard-refresh the tab, and look under MDSNodes → logic for "String Switch". No dependencies to pip install - the pack's requirements.txt is literally one blank line - and no models. MIT, version 1.8.0.
Worth being straight about the reputation side: this is a single-author utility pack with essentially no discussion in the ComfyUI subreddits - nothing for the pack name, nothing for the author. The code is short enough to read in a minute, so that's fine, but you won't find a video walkthrough when it misbehaves.
Common issues
Output is empty even though the switch is on. A fresh node defaults to True, so you're reading true_switch_string - check you actually filled that box and not the other one. Both are empty by default, so the node is silent about it.
You can't connect a STRING or INT to the checkbox. It's typed BOOLEAN. Feed it from something that emits a boolean, or from Not/And style logic nodes, not from a number.
The two boxes look alike in a screenshot. The tooltip says "First String" / "Second String" while the fields are true_switch_string / false_switch_string. Same thing, different vocabulary - there's no missing node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| switch | BOOLEAN | true | True outputs the First String, False outputs the Second String. |
| true_switch_string | STRING | Text returned when the switch is True. | |
| false_switch_string | STRING | Text returned when the switch is False. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | The selected string. |