Nodes/Qaz Tools/Text Switch (2-way)
ComfyUI Node

Text Switch (2-way)

Two prompts, one toggle

By qazwsxedc121·Created 3 months ago·Updated 3 months ago· 1
Text Switch (2-way)
    • STRING
    select1
    text1
    text2

    Text Switch (2-way) is the Qaz Tools pack's answer to a question you'll ask on day three of ComfyUI: how do I flip between two prompt variants without rewiring the graph? The answer is one select integer and two literal text slots. Set select to 1 or 2, and the matching text comes out the other end. That's the whole node, and that's fine.

    You'd reach for it to A/B two versions of a prompt against a fixed sampler seed, to route between a real prompt and an empty string when you want a promptless baseline, or to swap between two style blocks from a single widget. It's deliberately simpler than the switch nodes in rgthree or WAS Node Suite - no lists, no any-type passthrough, just strings and an index. When two static slots is all you need, this is the smallest tool that does the job.

    How it works

    Mechanically trivial, and the code doesn't hide anything: execute returns text1 if select == 1, otherwise text2. The input fields are plain multiline strings you type into the node - no dynamic prompt syntax is processed on them, they're passed through verbatim. The output is a single STRING, ready for a CLIP Text Encode or a QazOutput to see which branch you're on.

    The inputs that matter

    • select - integer, 1 or 2. Drive it from a widget, or wire it from any node that emits an INT.
    • text1, text2 - the two candidate strings, both optional and both multiline.

    One edge case worth knowing: the widget clamps select to 1–2, but if you drive it from another node's integer, anything that isn't exactly 1 resolves to text2. A 0 from a faulty upstream silently picks branch two.

    Installing Qaz Tools

    Same as every node in the pack: Qaz Tools is a small personal toolkit from qazwsxedc121, no models, no requirements.txt. Install, then restart ComfyUI:

    cd ComfyUI/custom_nodes
    git clone https://github.com/qazwsxedc121/comfyui-qaz-tools
    

    Or in ComfyUI Manager, search "Qaz Tools" / paste the repo URL under Install via Git URL.

    Nothing else to troubleshoot - if you're getting the wrong branch, check the value on the select wire, because the node itself is doing exactly what it says.

    CategoryQaz Tools

    Inputs (3)

    NameTypeDefaultDescription
    selectINT11–2
    text1optSTRING
    text2optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING