Nodes/Nifty Nodes for ComfyUI/Index Input Switch
ComfyUI Node

Index Input Switch

The data-driven router

By Stibo·Created 5 months ago·Updated 2 months ago· 9
Index Input Switch
  • values
  • output
index1

The two-way Input Switch handles "A or B." Nifty Index Input Switch handles "A through P": one integer index routes between up to 16 inputs of any type, and the auto-growing values list adds a new slot every time you connect another wire.

The 1–16 index is the whole interface - 1 passes value1, 2 passes value2, and so on. Because the selector is a plain INT, you can drive it from anywhere: a slider, a widget, a Nifty Math expression, even the index output of another switch. That's the "data-driven" bit - your workflow's routing can be computed rather than hard-coded.

The lazy part

Like the rest of the Nifty logic suite, this is the lazy variant: only the input at the selected index is evaluated, and the other fifteen never run. That's the difference between a router you can trust and one that executes sixteen expensive branches. If the index points at an unconnected slot, output is None - which is exactly the signal you want feeding a fallback chain or an Is None check.

Where you'll use it

  • Preset-ish selection. Sixteen different models, latents, or prompts; pick by index from a config value.
  • Round-robin and parity tricks. Drive the index with frame % N and a batch rotates through alternatives.
  • Config-driven graphs. A single INT upstream steers which branch of the workflow actually computes - cheap, readable, and lazy, so only the chosen path costs anything.

If you're tired of remembering "index 4 = the red one," the Index Combo Switch replaces the raw number with a named dropdown - same routing, human-readable labels.

Install

Nifty Nodes is a recent v3-API pack; install via ComfyUI Manager (search "Nifty Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes

Restart ComfyUI. No extra dependencies. The eager twin, Nifty Index Input Switch (Eager), exists if you need every branch to run regardless - but for routing, lazy is what you want.

Categorynifty/logic

Inputs (2)

NameTypeDefaultDescription
indexINT11–16Which value input to pass through (1–16).
valuesoptCOMFY_AUTOGROW_V3Auto-growing list of inputs. Only the selected index is evaluated (lazy).

Outputs (1)

NameTypeDescription
outputCOMFY_MATCHTYPE_V3