Nodes/ComfyUI Easy Use/easy textSwitch
ComfyUI Node Runs on cloud

easy textSwitch

Flip between two text inputs with one number

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
easy textSwitch
    • STRING
    input1
    text1
    text2

    A two-way selector for text. You've got two strings wired in; input set to 1 passes the first, set to 2 passes the second. That's the entire node, and it's exactly the kind of small switch that makes a workflow flexible without a rewire.

    It's in ComfyUI-Easy-Use's Logic/Switch group - the family of nodes for routing values around a graph based on a selector rather than by physically moving cables.

    Why you'd reach for it

    Because sometimes you want to toggle between two prompts (or two of anything text-shaped) from one place. A "day" prompt and a "night" prompt. A safe caption and a detailed one. A positive fragment you swap for another. Rather than editing the prompt itself each time, park both in a textSwitch and flip the number - one edit, and it's obvious at a glance which is active. The real power comes when the input selector is driven rather than typed: hook it to a comparison, a loop counter, or an XY-plot axis, and the graph chooses the text for you. A/B two prompts across a grid by sweeping the selector.

    How it works

    input is an integer, 1 or 2. The node reads it and outputs whichever of the two text inputs it points at. No merging, no concatenation - it's a clean either/or. If you need to join two strings instead of choosing between them, that's easy promptConcat; if you need more than two options, the pack has wider switch and index nodes (easy indexAnything, easy anythingIndexSwitch).

    The inputs and output

    • input - the selector: 1 picks text1, 2 picks text2. Type it, or drive it from another node.
    • text1 / text2 (optional inputs) - the two candidate strings.

    Output: a single STRING - the selected text. Wire it into a CLIP Text Encode, a filename, or anywhere a string is wanted.

    Installing it

    ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/yolain/ComfyUI-Easy-Use, install requirements, restart. No models, no dependencies.

    Where people trip

    Barely anything, but note the indexing is 1 and 2, not 0 and 1 - if you drive the selector from a zero-based counter you'll be off by one and always land on the wrong branch (or out of range). Second, if a branch's text input is left unconnected and you select it, you'll pass an empty string downstream - which is sometimes what you want and sometimes a silent surprise, so wire both if both matter. For a straight two-way text toggle it's about as foolproof as a node gets.

    CategoryEasyUse/Logic/Switch

    Inputs (3)

    NameTypeDefaultDescription
    inputINT11–2
    text1optSTRING
    text2optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING