Toggle Switch
A light switch for your graph, configured by JSON and overridable by a wire
- state
MKRToggleSwitch is a boolean source you can flip. It outputs one BOOLEAN (state) that's true by default, and you can drive it two ways: through a JSON settings string on the node, or by wiring a boolean in. If you wire state_in, the wire wins over the JSON. If you don't, the JSON's enabled field is what comes out. That's the whole job, and honestly it's a small job - but in a graph that's mostly plumbing (which is most of the graph), a switch you can't accidentally click off is worth having.
The node lives in the utility/logic layer, alongside every other pack's A/B switches and any-switches. The difference here: most switch nodes pick between two inputs you give them. This one is the input - it's a themed PrimitiveBoolean with a JSON home for its default state. Core ComfyUI already ships PrimitiveBoolean, so if you just want a plain true/false source you already have one. What MKR adds is the settings_json bundle and the state_in override, which matters when some other system is driving your workflow: leave the default in JSON, let an upstream node (or an external payload) flip it per run.
The inputs that matter
settings_json- the only required input. Default is{"enabled": true, "theme": "lime"}. It's a multiline string, not a picker. Theme choices arelime,graphite,rose,amber. Heads up: this pack ships no frontend extension for this node (it's not in the README'sWEB_DIRECTORYlist), so the theme is recorded metadata, not a fancy rendered widget. Don't expect a styled switch on canvas.state_in- optional boolean input, markedforceInput. Wire this and it overridesenabledfrom the settings.
Output is a single state boolean. Wire it into anything that wants a boolean - an enabled gate, a switch selector, a conditioning toggle.
Install
It ships inside MKRShift Nodes, so you install the whole pack. ComfyUI Manager: search MKRShift_Nodes (or "MKRShift Nodes") and install. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
Restart ComfyUI. No pip dependencies - the pack's pyproject.toml has no runtime requirements, and this node in particular needs nothing but the standard library.
Where people get burned
The settings string is JSON and the node is forgiving to a fault: malformed JSON silently falls back to defaults rather than erroring. If your toggle is "always on" no matter what you type, your settings_json is broken - open it, fix the quotes, and remember booleans in JSON are lowercase true/false, not Python True/False. Also: if you leave state_in unconnected and then edit the JSON, nothing re-runs unless something upstream changes - ComfyUI's cache thinks the node is unchanged, which is the classic always-rerun trap from the plumbing layer. Convert a widget or touch the JSON and re-run if your flip didn't stick.
It's a one-trick node. For a toggle in a single graph, the core primitive is lighter. For a switch whose default lives in a config bundle and that a wire can override, this is exactly the shape you want.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| settings_json | STRING | {"enabled": true, "theme": "lime"} | — |
| state_inopt | BOOLEAN | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| state | BOOLEAN | — |