ComfyUI Node

String Item Menu

A text dropdown without a dropdown

By drmbt·Created 2 years ago·Updated 7 months ago· 6
String Item Menu
    • output_string
    • index
    menu
    delimiter,
    select_item
    int_select-1

    String Item Menu is a clever little workaround for a ComfyUI UI limitation. Native ComfyUI widgets can't easily make a text field act like a dropdown menu - you get an enum dropdown when the node defines the choices, but you can't have the choices come from your own text. This node fakes it: you type a comma-separated list in one field, and you select from it by name or index. Whatever you picked comes out as output_string plus its index.

    How it works

    Three inputs, one optional:

    • menu - your delimited list. Default delimiter is a comma, so red, green, blue makes a three-item menu.
    • delimiter - change it to |, ;, newline, whatever your data uses.
    • select_item - the item you want, by name. Type green and get green out with its position.
    • int_select (optional) - forget the name matching; pick by index directly.

    The source is simple and honest about its limits: it splits menu on the delimiter, and if select_item isn't found in the list, it silently falls back to the first item. So if you leave select_item empty you just get the first entry - which is fine as a default, but a subtle trap if you think you've selected something and it quietly returns index 0. When int_select is set (0 or above), it takes over entirely and ignores name matching.

    Outputs are output_string (the chosen item) and index (its position in the list). Wire output_string into anything that takes text, or use index to drive a subsequent selection node.

    Why you'd use it

    The practical win is keeping a reusable list of options in one editable place instead of scattered across hardcoded enums. A style list, a list of LoRA names, a set of prompt prefixes - type them once, reference by name, and your workflow reads like a config file. It also plays well with the pack's list utilities: generate a list somewhere upstream, feed it in as menu, and select from it dynamically instead of editing the workflow.

    Where people get burned: spaces and case matter. red,green,blue splits cleanly on a comma, but red, green, blue (with a space after the comma) gives you " green" with a leading space, and select_item: green won't match - so you get the silent fallback to item 0. Either keep your lists tight (red,green,blue) or change the delimiter to something unambiguous. It's the one sharp edge in an otherwise friendly node.

    Install

    It lives in drmbt/comfyui-dreambait-nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/drmbt/comfyui-dreambait-nodes
    

    then restart ComfyUI (ComfyUI Manager: search "comfyui-dreambait-nodes"). As with the rest of the pack, the install drags in the heavy deps (transformers, bitsandbytes, librosa…) that this text-splitting node will never touch - that's the cost of the bundle. It's a small, specific convenience, but it's the kind of node that quietly becomes part of your template workflows once you've used it once.

    Categorystring selection

    Inputs (4)

    NameTypeDefaultDescription
    menuSTRINGThe text to be split into a list by the delimiter.
    delimiterSTRING,Delimiter to split the input string.
    select_itemSTRINGSelect item and index by name from the menu.
    int_selectoptINT-1Input string to be split into menu items.

    Outputs (2)

    NameTypeDescription
    output_stringSTRING
    indexINT