Nodes/ComfyUI-PM-Nodes/Dynamic Dropdown
ComfyUI Node

Dynamic Dropdown

The ComfyUI dropdown that rebuilds itself while you type

By pixel-magician·Created 7 months ago·Updated about a month ago· 1
Dynamic Dropdown
    • index
    • selected_value
    optionsOption1,Option2,Option3
    selection

    ComfyUI's built-in dropdowns are baked. The options live in the node's definition, so every "pick your model" combo is fixed until you edit code. Dynamic Dropdown from the PM Nodes pack is the workaround: one plain text field, and the dropdown next to it repopulates itself from whatever you type. Change the list, the menu changes with it. No code, no restart.

    What it actually does

    The node has two widgets sitting side by side. Type into options - a plain string - and selection becomes a dropdown populated from that text. The default is Option1,Option2,Option3, but that's just a placeholder; the README's example is quality tiers like 低质量,中等质量,高质量 (low, medium, high quality). Any delimiter works: commas, semicolons, newlines, even plain spaces. The parser normalizes everything with one regex, strips empties, and dedupes while keeping order. The README sells it as "comma, semicolon or newline separated" but honestly the whitespace support means you can paste a sloppy list and it just works.

    How it works

    There are two halves. The backend (dynamic_dropdown_node.py) is boring and reliable: it parses the options text and returns the chosen entry. The frontend (web/extensions/dynamic_dropdown.js) is where the magic is - it watches the options text box, polls for changes every 300ms, and rebuilds the selection combo's list live. If your currently-selected entry vanishes because you edited the list, it quietly snaps to the first option. The backend also skips its own combo type-checking, because the list is changing under it at runtime; the frontend owns validation instead.

    The input/output contract is small enough to hold in your head:

    • options (string) - the list source. Type directly or convert the widget to an input and drive it from elsewhere.
    • selection (combo) - what you picked.
    • index (INT) - the 0-based position of your pick in the list. Useful if a downstream node wants a number.
    • selected_value (STRING) - the text you picked. This is the one you'll wire somewhere 90% of the time.

    Why you'd reach for it

    Anywhere you're choosing between a small set of things at generation time: which checkpoint to use, which prompt to run, which upscale style, which LoRA weight preset. selected_value wires straight into anything that takes a string - a CLIP Text Encode, a filename prefix, a math node. Combine it with an IF Branch (also in this pack) and you get a poor man's UI for flipping between presets without hunting through node menus mid-run.

    Install

    From ComfyUI Manager, search "PM Nodes" and install. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pixel-magician/ComfyUI-PM-Nodes.git
    

    Restart ComfyUI. There are no extra dependencies and no model downloads - the pack uses the newer comfy_api.latest authoring API that ships with ComfyUI 1.0+, so a clone is genuinely all it takes.

    Gotchas

    • Remember the 0-based index. First item is 0, not 1. It trips people up the first time they wire index into something.
    • Edit the list so your pick disappears and it silently selects the first item. Not a bug, just behavior to expect.
    • The pack is young (v0.0.9) and by a single author with little community footprint yet. It's a clean little node, but don't treat the docs as gospel - the source is short and readable if you ever want to check what a field actually does.
    CategoryPM Nodes

    Inputs (2)

    NameTypeDefaultDescription
    optionsSTRINGOption1,Option2,Option3
    selectionCOMBO3 options: Option1, Option2, Option3

    Outputs (2)

    NameTypeDescription
    indexINT
    selected_valueSTRING