Nodes/SP-Nodes/Bool Switch Out Str
ComfyUI Node

Bool Switch Out Str

Turn a checkbox into text

By bananasss00·Created 2 years ago·Updated 6 days ago· 20
Bool Switch Out Str
    • state
    enabledtrue

    This is one of those small utility nodes you don't think about until the exact moment you need it: you've got a boolean toggle somewhere in your graph, and something downstream wants a string instead of a true/false value. That's the entire node.

    How it works

    There's nothing hidden here. enabled (a boolean, defaulting to true) goes in, and state (a string) comes out, carrying that value in text form. No conversion options, no formatting knobs - it's a one-line adapter between ComfyUI's boolean type and anything downstream that only accepts strings.

    The inputs and outputs that matter

    • enabled - the toggle you're converting.
    • state - the string output, wired into whatever text-based node actually needs it.

    Why you'd reach for it

    Anywhere a bool needs to become text: feeding a toggle's current state into a filename, into a text concatenation node for logging or organizing outputs, or driving a text-based branch where the receiving node only accepts a STRING input and has no native way to accept a boolean directly. It's not a node you build a workflow around - it's the small connective piece that keeps you from having to route a bool through something heavier just to get a string out of it.

    SP-Nodes ships several plain text-manipulation nodes of its own - string concatenation, multiline joins, find-and-replace - and BoolSwitchOutStr is the natural first hop before any of them when the value you're starting from is a boolean rather than text. Without a converter like this, the usual workaround is a bigger, more general-purpose "any to string" or conditional node just to cover the one case of turning a checkbox into text, which is more graph clutter than the job actually needs.

    How to install it

    Through ComfyUI Manager: search "SP-Nodes," install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bananasss00/ComfyUI-SP-Nodes
    

    Restart ComfyUI and it'll be available under the SP-Nodes category.

    Common issues

    Honestly, there's not much to troubleshoot on a node this small - it does one thing and does it predictably. The only real advice worth giving: it's easy to forget this node exists once your graph gets complicated, and instead reach for a heavier text-manipulation node to do the same one-step conversion. Once you know BoolSwitchOutStr is sitting in the pack, it's worth keeping favorited in ComfyUI Manager - you'll reach for it more often than the click-count on this page suggests.

    If you find yourself wanting the reverse - turning a string back into a boolean, say to gate a switch based on some upstream text value - check the rest of the pack before reaching for something bigger; SP-Nodes ships a family of small string-conversion utilities in this same spirit, and it's worth a scroll through ComfyUI Manager's node list for this pack before assuming you need to write your own.

    CategorySP-Nodes

    Inputs (1)

    NameTypeDefaultDescription
    enabledBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    stateSTRING