Nodes/ComfyUI-RE-CustomUtils/Prompt Layout Filler
ComfyUI Node

Prompt Layout Filler

Mail-merge for your prompt — a template with 10 slots you can feed from anywhere

By relhamdi·Created 7 months ago·Updated 2 months ago· 1
Prompt Layout Filler
    • text
    template
    cleanuptrue
    preset_data{}
    slot_0
    slot_1
    slot_2
    slot_3
    slot_4
    slot_5
    slot_6
    slot_7
    slot_8
    slot_9

    If you've ever built a prompt out of separate pieces - subject, pose, background, lighting - you've probably done it with a chain of string-concat nodes and cursed at the commas. PromptLayoutFiller is the cleaner version: you write a template once, with {0}, {1}-style placeholders, and then plug each piece into a slot. It's mail-merge, but for prompts.

    How it works

    Write the template in the template field:

    character, {0:position}, {1:background}, {2:lighting}
    

    The {0:position} syntax is the important bit - the number is the slot index, and the word after the colon is just a visual label that never reaches the output. Then connect nodes to the matching slots: slot_0, slot_1, slot_2. At execution each placeholder is replaced by its connected value. Slots appear one at a time as you connect the previous one, so the node stays tidy instead of dumping ten empty inputs on you.

    The natural sources are PromptOptionPicker nodes - one for poses, one for backgrounds, one for lighting, each managing its own list. Slot lengths don't need to match, so you can swap a 3-option lighting picker for a 9-option one without touching the template. When you want to change what the prompt says, you edit a picker, not the template.

    The inputs that matter

    • template - multiline, with {N} or {N:label} placeholders. Gets a highlighted editor: green for placeholders whose slot is connected, red for ones you've referenced but haven't wired up. That red is your early warning.
    • cleanup - default on, same cleanup rules as the rest of the pack. Vital when a slot outputs an empty string and leaves you with character, , , dark-style debris; it scrubs the residual commas and empty parens.
    • slot_0 through slot_9 - connectable STRING inputs.
    • preset_data - internal storage for the preset system; you don't touch it.

    One output: text, the fully resolved prompt, ready for a text encoder.

    Presets - the underrated feature

    This node can remember whole slot configurations as named presets, and they're stored inside the workflow. The header buttons are (new preset from current values), 💾 (overwrite), 🗑️ (delete), plus 📋 Export and 📥 Import which move all presets as JSON via clipboard. Recalling a preset pushes its saved values back into the connected source nodes - so if you've saved "outdoor day" and "indoor night" as two setups, you're one dropdown away from either.

    The catch, honestly documented: recalling pushes values into source nodes, so if a source no longer offers that value, or a source got disconnected, it errors rather than guessing. That's the trade-off for the two-way sync.

    Installing it

    It's in ComfyUI-RE-CustomUtils. ComfyUI Manager → search the pack, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/relhamdi/ComfyUI-RE-CustomUtils
    

    Restart ComfyUI. No extra packages, no model downloads - the pack's only declared dependency is torch.

    Where people get burned

    • Referenced-but-disconnected placeholders error out. That's by design - it refuses to run with a hole in the template - but it means you can't temporarily unplug a slot and still test. Leave a picker in place even if you don't want its value.
    • Index 9 is the ceiling. A placeholder beyond slot_9 fails validation. Ten slots is plenty, but know the limit.
    • Empty template stops the workflow too.

    The one-two punch this pack is built around is PromptOptionPickerPromptLayoutFiller → text encoder: pick your pieces, fill the template, generate. If that's the workflow you want, this is the node that makes it feel like one thing instead of ten.

    CategoryRE-CustomUtils

    Inputs (13)

    NameTypeDefaultDescription
    templateSTRINGTemplate with placeholders. Ex: character, {0:position}, {1:background}
    cleanupBOOLEANtrueClean up residual artifacts from empty slots.
    preset_dataSTRING{}
    slot_0optSTRINGValue for placeholder {0}.
    slot_1optSTRINGValue for placeholder {1}.
    slot_2optSTRINGValue for placeholder {2}.
    slot_3optSTRINGValue for placeholder {3}.
    slot_4optSTRINGValue for placeholder {4}.
    slot_5optSTRINGValue for placeholder {5}.
    slot_6optSTRINGValue for placeholder {6}.
    slot_7optSTRINGValue for placeholder {7}.
    slot_8optSTRINGValue for placeholder {8}.
    slot_9optSTRINGValue for placeholder {9}.

    Outputs (1)

    NameTypeDescription
    textSTRING