Nodes/NH-Nodes/List Create (NH)
ComfyUI Node

List Create (NH)

Make a list ComfyUI can actually index into

By jetthuangai·Created 5 months ago·Updated 21 days ago· 6
List Create (NH)
    • items
    • count
    • first
    • last
    textitem 1 item 2 item 3
    delimiter\n

    Most of the time "a list of things" in ComfyUI is just a big multiline text box, and every node downstream has to re-parse it. List Create (NH) (class NH_ListCreate) is the node that turns that text into an actual NH_LIST value - something you can hand to the pack's list nodes and have them index, filter, and count without re-splitting the string. It's plumbing, but it's plumbing that makes a surprising number of workflows cleaner.

    How it works

    You type (or wire in) multiline text, and it splits on a delimiter - default \n, so one item per line. It strips each item and drops empty lines, so trailing whitespace and blank rows don't create phantom list entries. What comes out:

    • items - the NH_LIST itself. This is what you wire into List Index (NH) or List Filter (NH).
    • count - how many items. Great for wiring into a loop or a "how many did I give you" check.
    • first / last - the head and tail of the list, exposed as plain strings so you don't need an index node just to grab either end.

    The delimiter is a real string, not just newline: the node translates escaped \n and \t sequences, so you can set delimiter to , or | and feed it single-line CSV-ish text. That's the sneaky useful bit - you're not locked into the multiline layout.

    Where you'd actually use it

    It's the front of the NH list pipeline: List CreateList Index / List Filter for selecting items, or feed first/last into text tooling. The natural ComfyUI pattern is to convert a widget to input and drive a selection from one authoritative list rather than editing the same set of names in five nodes. If you find yourself re-typing the same multiline text across nodes, this is the fix.

    Installing

    From ComfyUI Manager, search NH-Nodes, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jetthuangai/NH-Nodes.git
    cd NH-Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI and refresh the browser page. This node is pure Python string handling - no extra dependencies beyond what ComfyUI already has.

    Gotchas

    The items are strings, full stop. An NH_LIST from this node won't magically feed an image batch or a model list - it's for text selection logic. Also, empty lines are dropped, so if an empty string is a meaningful item in your data, this node will eat it. And it's worth knowing the type is pack-specific: NH_LIST only connects to other NH-Nodes list sockets, so if the node you're feeding expects a plain string, use first/last or a List Index (NH) instead.

    CategoryNH-Nodes/Batch

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGitem 1 item 2 item 3
    delimiteroptSTRING\n

    Outputs (4)

    NameTypeDescription
    itemsNH_LIST
    countINT
    firstSTRING
    lastSTRING