Nodes/NH-Nodes/Prompt Join (NH)
ComfyUI Node

Prompt Join (NH)

Building prompts from fragments without the comma soup

By jetthuangai·Created 5 months ago·Updated 21 days ago· 6
Prompt Join (NH)
    • result
    • count
    separator,
    skip_emptytrue
    text_1
    text_2
    text_3
    text_4
    text_5

    ComfyUI is full of small annoyances, and hand-assembling a prompt from pieces is a classic. You've got a subject fragment, a style fragment, a quality tail, and you're typing them together with commas in your head - which works until one of them is empty and your prompt reads a portrait of, , masterpiece. Prompt Join (NH) is the small, boring node that fixes exactly that.

    It takes up to five text inputs (text_1 through text_5), joins them with a separator you choose, and spits out a single result string. The defaults are already sensible: separator is ", " (comma-space) and skip_empty is on, so blank fragments are dropped before joining instead of leaving dangling commas. It also outputs count, the number of fragments that actually made it in - handy for logging or routing ("did we get a style term or not?").

    The behavior under the hood is a touch stricter than you might expect: each fragment is stripped of surrounding whitespace before joining, and with skip_empty on, a fragment that's only whitespace counts as empty. So " portrait " becomes portrait, and a genuinely blank slot disappears. That whitespace cleanup is the difference between clean joins and accidental double spaces, and it's the main reason to use this over just wiring strings into a concatenate node.

    What it's actually for

    This shines wherever prompt fragments come from different places - a base-subject node, a style-preset node, a wildcard-ish selection, maybe a tag pulled out of a filename. Instead of one giant text box you have to edit in five places, each fragment lives in its own small node and Join assembles them. It's the prompt-engineering version of one-source-many-consumers: change the style fragment in one spot and every downstream prompt updates.

    Where people get tripped up: it's a join, not a format. If you need {subject}, {style} <lora:thing:0.8> with different separators between each pair, or per-slot fallbacks, this node won't do it - that's Prompt Template (NH) territory. Also note the hard ceiling: five inputs. If you need eight fragments, chain two Joins or look at the Text Concatenate node, which goes up to 64.

    Install

    Part of the NH-Nodes pack, so the usual:

    • ComfyUI Manager → search NH-Nodes → install → restart ComfyUI. Or manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/jetthuangai/NH-Nodes.git
    cd NH-Nodes
    pip install -r requirements.txt
    

    Then restart ComfyUI.

    No models, no extra deps - it's a plain text node.

    Common issues

    Most problems here are expectations, not bugs. If your output has a comma stuck on the front, you've probably got a leading-space fragment that skip_empty doesn't catch (it's not empty, it's just whitespace-y - though the strip usually saves you). If the count output looks wrong, remember it counts joined fragments, not inputs. And if you turn skip_empty off, empty slots come through as empty strings - which is exactly when you'll see the double-comma soup this node was built to prevent.

    CategoryNH-Nodes/Text

    Inputs (7)

    NameTypeDefaultDescription
    separatorSTRING,
    skip_emptyBOOLEANtrue
    text_1optSTRING
    text_2optSTRING
    text_3optSTRING
    text_4optSTRING
    text_5optSTRING

    Outputs (2)

    NameTypeDescription
    resultSTRING
    countINT