Nodes/ComfyUI Prompt Builder/Text Prompt Node
ComfyUI Node

Text Prompt Node

The one-node building block that ends prompt retyping

By AIMovieStudio·Created 8 months ago·Updated 7 months ago· 2
Text Prompt Node
    • prompt_var
    var_namesubject
    text

    You know the grind: you keep three or four variations of the same prompt block - the subject, the style, the lighting - and you're forever copy-pasting them between the positive box, the negative box, and the last workflow you downloaded. Text Prompt Node is the antidote. It's the atomic unit of the ComfyUI Prompt Builder pack: a single node that turns one chunk of text into a named, reusable variable. Instead of pasting "a confident Shiba Inu" into five different places, you define it once and reference it everywhere.

    The name undersells it a little. This isn't a "prompt" node in the sense of something you plug straight into a KSampler. It's a variable node - think of it as a labeled sticky note that hands its contents to the pack's builder nodes downstream.

    How it works

    Under the hood it's almost embarrassingly simple, and that's the point. You give it two strings:

    • var_name - the name other nodes will use to refer to this text (defaults to subject).
    • text - the actual prompt content, a multiline string.

    It then emits a custom PROMPT_VAR output. That's not a plain STRING; the node packages your text into a small bundle carrying both the name and the value. That's what lets the builders place it correctly: connect this to a Text Prompt Builder and {subject} in the template gets replaced with whatever text holds, and the JSON builder uses var_name as the key. You can't wire this output directly into CLIP Text Encode - it's not a STRING, and you'll get a type mismatch if you try. The builders are the bridge.

    The mechanism matters for one practical reason: var_name becomes a template key, so keep it a clean identifier. No spaces, no weird punctuation - subject, style, lighting, character_name. If you want to reference it by name in a template and you give it a space, you're going to have a bad time (more on that in the Text Prompt Builder article).

    What to actually set

    Really just the two fields above. The default subject is fine for your first variable; the text box is where your actual prompt language goes - a tag list for an SDXL-lineage checkpoint, a sentence block for an LLM-encoded model. The block-structure habits from prompt engineering slot in naturally here: one node for your quality tags, one for the scene description, one for the style, and you can edit any block without touching the rest.

    Installing it

    It ships inside ComfyUI Prompt Builder, so one install gets you all five nodes. Easiest is ComfyUI Manager - search "ComfyUI Prompt Builder" and hit install. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aimoviestudio/comfyui-promptbuilder
    

    Then restart ComfyUI. That's the whole install - the pack has no Python dependencies and downloads no models, which is rare in this ecosystem and worth appreciating given how much of ComfyUI's reputation is dependency hell.

    Where people get tripped up

    Two things. First, the dynamicPrompts: False setting on the text field - the pack disables ComfyUI's built-in {a|b|c} wildcard syntax here so it doesn't mangle your {var_name} placeholders. So don't try to write wildcard brackets inside text; that's a different feature and it's off for a reason. Second, remember this node is only useful in pairs - on its own it does nothing visible. You'll want it feeding a Text Prompt Builder or Json Prompt Builder, and then you'll wonder why you ever typed the same phrase twice.

    CategoryPromptBuilder

    Inputs (2)

    NameTypeDefaultDescription
    var_nameSTRINGsubject
    textSTRING

    Outputs (1)

    NameTypeDescription
    prompt_varPROMPT_VAR