Nodes/Shima/Shima Choice Switch
ComfyUI Node

Shima Choice Switch

A toggle switch that knows boolean, integer, and string

By KDB-USJP·Created 6 months ago·Updated 6 months ago· 2
Shima Choice Switch
    • choice
    • boolean
    modeBoolean
    value1
    option_1_strTRUE
    option_2_strFALSE
    option_1_color#3a5a7c
    option_2_color#571a1a
    layoutWide
    font_size18

    ComfyUI's boring boolean toggle gets the Shima treatment in Choice Switch: a chunky, color-coded physical toggle rendered right on the canvas. Flick it and it hands a value downstream - and here's the useful part, it can hand out a boolean, an integer, or a string depending on the mode you set. It's a two-way A/B switch with a face, and for workflows where you flip between two prompt variants or two settings by hand, it's nicer to look at and easier to find than a bare checkbox.

    How it works

    Under the hood it's a two-position switch with a hidden integer (value, 0 or 1) tracking which side is up. The mode dropdown decides what the primary output actually is:

    • Boolean - outputs True or False.
    • Integer - outputs 1 or 2.
    • String - outputs whichever of option_1_str / option_2_str you've filled in.

    The two option strings are both visible as widgets, so in string mode this doubles as a tiny inline label: "ON" / "OFF", "SDXL" / "Flux", whatever you're choosing between. The option_1_color and option_2_color widgets tint the toggle so you can color-code at a glance - the defaults are a calm blue for option 1 and a warning red for option 2.

    Two outputs come off the node. The first, choice, is the polymorphic value (its type matches your mode). The second, boolean, is always a plain boolean - True when option 1 is selected, False for option 2. That second output is the quiet workhorse: you can wire it into a Highway Detour, a conditional, or anything else that wants a clean True/False signal, regardless of what mode the switch is in.

    The inputs that matter

    Honestly, only a few widgets matter on a normal day:

    • mode - set once: Boolean, Integer, or String.
    • value - the switch position. It's marked hidden in the schema, meaning the frontend toggle drives it rather than you typing numbers.
    • option_1_str / option_2_str - the labels, which double as the string outputs.
    • layout (Wide / Stacked) and font_size - pure cosmetics.

    Installing it

    Part of the Shima pack. ComfyUI Manager → search Shima, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/KDB-USJP/shima_wf.git Shima
    

    Restart ComfyUI; first launch auto-installs the pack's deps and companion repos (ComfyUI-Impact-Pack, cg-use-everywhere).

    Common issues

    • "The switch doesn't stay how I left it." Choice Switch is marked as an output node (OUTPUT_NODE = True in the source), so it re-executes even when nothing's connected downstream. That's expected; the position itself is what you set by hand.
    • "My string mode returns the wrong label." Remember option 1 maps to True/1, option 2 to False/2. If your labels feel swapped, you've got the mental model backwards - which side is "option 1" follows the value, not the color.
    • It's a manual switch, not a fallback. Unlike rgthree's Any Switch, this won't auto-pick the first non-null input. It always returns the side you selected. If you want the graph to decide, look elsewhere.

    For a quick, legible way to flip a setting by hand - and get a clean boolean out for free - this does the job without ceremony. The styling is the point; the logic is refreshingly simple.

    CategoryShima/Utilities

    Inputs (8)

    NameTypeDefaultDescription
    modeCOMBOBoolean3 options: Boolean, Integer, String
    valueINT10–1
    option_1_strSTRINGTRUE
    option_2_strSTRINGFALSE
    option_1_colorSTRING#3a5a7c
    option_2_colorSTRING#571a1a
    layoutCOMBOWide2 options: Wide, Stacked
    font_sizeINT188–24

    Outputs (2)

    NameTypeDescription
    choice*
    booleanBOOLEAN