Nodes/Painting Coder Utils/Text Switch 🔄
ComfyUI Node

Text Switch 🔄

One checkbox to swap between two prompts

By jammyfu·Created 2 years ago·Updated about a year ago· 16
Text Switch 🔄
    • text
    use_firsttrue
    text_1
    text_2

    The fastest way to test two prompts against the same seed and settings is a checkbox, not a rewire. Text Switch is exactly that: a use_first boolean and two text inputs, with the chosen string flowing out to whatever reads it. Swap the prompt, re-run, compare - same seed, same sampler, only the text changed.

    It's one of the four switch nodes in the Painting Coder Utils pack, and it's the text sibling of Image Switch, Mask Switch, and Latent Switch.

    How it works

    Checked, use_first outputs text_1; unchecked, it outputs text_2. Both inputs are optional, and if you select a path with nothing connected it returns an empty string instead of erroring - the graph keeps running, it just sends nothing down that branch. Both text inputs are multiline, so long prompts work fine.

    There's no processing beyond the pick: no trimming, no joining, no encoding. What you type (or wire in) is what comes out. Its job is to sit upstream of a CLIP text encode, a prompt-level node, or anything else that consumes a STRING, and flip between two candidates cleanly.

    Inputs and output

    • use_first - the boolean selector (default true).
    • text_1, text_2 - the two STRING inputs, both optional and multiline.
    • Output: text - whichever string you selected.

    Where you'll use it

    A/B prompt testing is the headline: two prompts, one seed, one sampler, flip the checkbox and queue twice, compare. It's also a neat gate for positive vs. negative styles - a "nice" prompt on one side, a "don't do this" variant on the other - or switching between a short and a long-form prompt for different runs without editing text in place.

    Honest note: if you run rgthree or a similar pack, its Switch nodes cover text (and other types) in one interface and you may not need this. But for a dependency-light, single-purpose toggle, this is exactly enough.

    Install

    ComfyUI Manager → Painting Coder Utils, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jammyfu/ComfyUI_PaintingCoderUtils.git
    

    Restart ComfyUI. No models, no API keys; the pack's dependencies (numpy, Pillow, torch, gradio) are already present in any working ComfyUI. And the pack-wide gotcha if you inherit old workflows: v0.3.0 renamed the node namespace, which breaks old references - the bundled docs/fix/workflow_fixer.html repairs the JSON.

    Category🎨Painting👓Coder/🔄Switch

    Inputs (3)

    NameTypeDefaultDescription
    use_firstBOOLEANtrue
    text_1optSTRING
    text_2optSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING