Nodes/Link Comfy Nodes/Dropdown Select
ComfyUI Node

Dropdown Select

A custom dropdown widget, plus the index you actually need

By Mister-Link·Created 9 months ago·Updated 23 days ago· 0
Dropdown Select
    • value
    • index
    options["Option A", "Option B", "Option C"]
    selectedOption A

    ComfyUI's built-in dropdown widgets come from a node's fixed choice list - you can't just define your own options on the fly without writing a node. Dropdown Select gets around that: you paste in a JSON list of options, pick one from an editable dropdown, and get back both the string you picked and its index in the list. Small node, but it fills a real gap - a reusable "preset picker" you define yourself instead of one baked into someone else's node.

    How it works

    You feed it a JSON array as text - the default is ["Option A", "Option B", "Option C"] - and the node turns that into an actual dropdown you can click and select from, rather than a plain text field. Whatever you pick gets output two ways: as the raw string value, and as its position in the list. That index is what makes this more than a glorified text box - it's the thing you'd wire into a Switch-style node elsewhere that branches on an integer rather than a string.

    The inputs and outputs that matter

    • options (STRING, required, default '["Option A", "Option B", "Option C"]') - your list of choices, written as a JSON array.
    • selected (STRING, required, default "Option A") - the currently chosen value; this is what the dropdown widget actually edits.

    Two outputs: value (STRING) - the selected option as text - and index (INT) - its zero-based position in the options list.

    How to install it

    Through ComfyUI Manager: search "Link Comfy Nodes," install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Mister-Link/link-comfy-nodes
    pip install -r link-comfy-nodes/requirements.txt
    

    Restart ComfyUI when it's done.

    Common issues & troubleshooting

    Malformed JSON in options. Since the list is typed as plain text, it's easy to break - a missing comma, unmatched quotes, a trailing comma that JSON doesn't tolerate. If the dropdown isn't updating or is throwing an error, paste your options string into any JSON validator first; it'll catch the syntax problem faster than staring at the node.

    selected value that isn't actually in options. If you edit the options list and the previously selected value no longer exists in it, you can end up with a selected field that doesn't match anything in the current list. Re-pick from the dropdown after changing options to make sure the two stay in sync.

    Expecting the index to be 1-based. Like almost everything in ComfyUI's Python backend, index counts from 0 - the first option in your list is index 0, not 1. If you're wiring the index into something that expects 1-based numbering, you'll need an offset node in between, or you'll be off by one everywhere downstream.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    optionsSTRING["Option A", "Option B", "Option C"]
    selectedSTRINGOption A

    Outputs (2)

    NameTypeDescription
    valueSTRING
    indexINT