Nodes/ComfyUI-N-Nodes/String Variable
ComfyUI Node Runs on cloud

String Variable

Text you can reuse across a graph

By Nuked88·Created 3 years ago·Updated 2 years ago· 237
String Variable
    • STRING
    value

    The third of this pack's three primitive-variable nodes, alongside Integer and Float. The reasoning is the same in all three: ComfyUI's built-in Primitive node can't link certain matched widgets to each other directly, and the README's own example is a KSampler's start_at_step and another KSampler's steps - you'd want those to agree, and stock ComfyUI won't let you wire them together. This node's job is holding one piece of text you can fan out to as many downstream inputs as need it, instead of typing (or mistyping) the same string into several places.

    How it works

    There's no transformation, formatting, or templating going on - it's a single multiline text field that becomes a STRING output, full stop. Type your text once, wire the output wherever it needs to land: a filename prefix, a shared prompt fragment, a tag you're reusing across a couple of CLIP Text Encode nodes, whatever. Because there's only one place the text is actually set, every consumer is guaranteed to be reading the identical string.

    The input and output

    value - a multiline string field, so it's fine for anything from a short tag to a full paragraph of prompt text. STRING - the single output. That's the whole node. It's a much smaller idea than something like rgthree-comfy's Context nodes, which bundle several connections into one wire; this only ever carries one value, and its entire value proposition is not needing you to keep two copies of the same text in sync by hand.

    Installing the pack

    • ComfyUI Manager - search "ComfyUI-N-Nodes," install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/Nuked88/ComfyUI-N-Nodes.git, then restart ComfyUI.

    No models, no GPU dependency, nothing to configure beyond typing your text into the widget.

    Common issues & troubleshooting

    Not sure this beats just typing the text twice. For a one-off, it probably doesn't - the payoff shows up when you're iterating on a prompt fragment or a filename convention and don't want to remember every place it's duplicated. If you find yourself editing the same string in two nodes every time you tweak it, that's the signal to route both through one of these instead.

    One of the two places you wired it isn't picking up your edits. Almost always a wiring mistake, not a node bug - check that the "stale" consumer is actually connected to this node's STRING output and not still holding its own local text value.

    You need this exact pattern but with the field literally named string. That's String Variable [n-suite], this pack's renamed, current-generation version of the same node - same idea, one field renamed, same output type.

    CategoryN-Suite/Variables

    Inputs (1)

    NameTypeDefaultDescription
    valueSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING