Nodes/AUN ComfyUI Nodes/Text Switch 2 Input With Text Output
ComfyUI Node

Text Switch 2 Input With Text Output

Two text inputs, one pick — selected by a label you actually remember

By loz2754·Created 8 months ago·Updated about 24 hours ago· 5
Text Switch 2 Input With Text Output
    • text
    text_a
    text_b
    label_aText A
    label_bText B
    chooseNone

    TextSwitch2InputWithTextOutput is the two-option text switch you didn't know you wanted until you wanted it. You feed it two strings, it hands back exactly one of them, and - this is the part that distinguishes it - you select which one by matching a custom label, not by index and not by the text itself.

    The practical upshot: your inputs can be "a cinematic portrait" and "a stark documentary shot", and instead of remembering that option 1 is the cinematic one, you label them Cinematic and Stark, then drive the switch with those words. The node reads like the workflow's intent instead of its plumbing.

    How it works

    Trivial and transparent. Each run compares the choose string against label_a and label_b. Match on label_a → output text_a. Match on label_b → output text_b. Match on neither → output an empty string. There's no index arithmetic to get backwards, no "which of these twenty was it" - just a string comparison.

    That third case is worth calling out because it's a feature, not a bug. With the default choose of None, an unconnected node returns an empty string, which makes it a clean conditional: wire it into a prompt concat and you get "nothing added" rather than a stray default. It's the same "or none" trick the node's description advertises.

    The inputs that matter

    • text_a / text_b - the two options. Both are forceInput sockets, so they come from other nodes (prompts, text switches, anything emitting STRING).
    • label_a / label_b - the names you pick from. Defaults are the uninspiring Text A / Text B; rename them to something meaningful and the node becomes self-documenting.
    • choose - the selector. A plain string widget (not a dropdown): type Cinematic to get text_a, Stark for text_b.

    One output: text - the chosen string, or "" if choose matches neither label.

    Where it fits

    Prompt A/B testing is the obvious home: two positive prompts, two negative prompts, or a "detailed vs. minimal" variant, with choose driven from an AUN Boolean or Single Label Switch so one toggle flips the whole style. Pair it with a text concat and the "neither" case makes it a clean conditional injector. It's a smaller sibling of AUN's Text Index Switch family - those handle many inputs by number; this one handles two by name, which is often all you need.

    The gotcha

    choose is an exact string match. Case matters, trailing spaces matter, and a typo silently falls through to the empty-string branch - you'll get a blank prompt and wonder what broke. If you're driving choose from another node, make sure whatever emits it outputs exactly one of your labels. When in doubt, check the node with a Show Text on the output.

    Also note the AUN compact-mode habit applies here: double-click the node body to hide the config widgets and keep the canvas tidy.

    Installing it

    AUN pack, same as every node in this collection. ComfyUI-Manager → search "AUN" → install, or:

    cd custom_nodes
    git clone https://github.com/loz2754/AUN-ComfyUI-Nodes
    

    Restart ComfyUI. This node is pure string logic - it needs nothing beyond the pack's own Python, though Manager will pull the shared deps (piexif, opencv-python-headless, imageio-ffmpeg, requests) for the image/video nodes anyway. Cloned manually and hit a missing-module error? pip install -r custom_nodes/AUN-ComfyUI-Nodes/requirements.txt.

    Small, boring, and exactly the kind of node that makes a workflow read well.

    CategoryAUN Nodes/Text

    Inputs (5)

    NameTypeDefaultDescription
    text_aSTRINGFirst text option.
    text_bSTRINGSecond text option.
    label_aSTRINGText ALabel used to select text_a.
    label_bSTRINGText BLabel used to select text_b.
    chooseSTRINGNoneWhich label to output. Set to label_a to output text_a, label_b to output text_b, otherwise outputs empty.

    Outputs (1)

    NameTypeDescription
    textSTRING