ComfyUI Node

String

String

By yolanother·Created 3 years ago·Updated 2 years ago· 13
String
  • clip
  • CLIP
  • STRING
variable
value

String is the "declare a named value once, use it everywhere" node from the Variables for Comfy UI pack. You give it a name and a chunk of text, and that text becomes available anywhere else in your graph that knows to look for it - namely the pack's own CLIP Text Encode (With Variables) node and its Format Text nodes, which understand {variable_name} placeholders.

Why you'd reach for it

Big workflows repeat themselves. A character description, a location, a style tag - the same fifteen words copy-pasted into six different text-encode boxes. Change one word and you're hunting through the graph fixing five other copies you forgot about. String fixes that the boring, obvious way: set the value once, reference it by name everywhere else, change it in one place when it needs changing.

How it actually works

Here's the part that trips people up: String isn't a node you connect its output into your prompt. It's a node you splice into your CLIP wire. Take the CLIP output from your checkpoint loader, run it through String first, then into your CLIP Text Encode nodes downstream. The node passes CLIP through completely unchanged - it's just hitching a ride.

Why bother with that instead of just running it off to the side? Because ComfyUI doesn't execute your graph top-to-bottom - it starts at the output nodes (Save Image, etc.) and works backward, pulling in only whatever those outputs actually depend on. A node sitting off in a corner with nothing downstream of it simply never runs. Splicing String into the CLIP chain guarantees it executes before anything that needs the variable it sets, because everything downstream genuinely depends on that CLIP output passing through it.

Inputs and outputs

Three inputs, and you'll only ever touch two of them per instance:

  • variable - the name you'll reference later, like character or style. Single line, keep it short and memorable.
  • value - the actual text this variable holds. This one's multiline, so paste in as much as you need.
  • clip - plug your checkpoint's CLIP output in here. This is what makes the node actually run (see above).

It outputs CLIP (the same object, untouched, so you keep chaining downstream) and STRING (the value you just set, in case you want to wire it somewhere directly too - into another Format Text node, say).

Installing it

It's a small pack with no baggage. Through ComfyUI Manager, search "Variables for Comfy UI" and install. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/yolanother/DTAIComfyVariables

Restart ComfyUI. The README lists exactly one dependency - ComfyUI itself - so there's no pip install, no model download, nothing else to fetch. About as light as custom nodes get.

Common issues

Forgetting the CLIP passthrough. If you leave clip unconnected, or set String off to the side without wiring it into anything, ComfyUI may never bother executing it at all, and your {variable_name} placeholder just sits there unreplaced in your final prompt. Keep it in the CLIP chain.

Name collisions. The pack's own description calls these "shared global variables," which is exactly what it sounds like - if you drop two String nodes with the same variable name in one workflow, whichever one runs last wins, silently. Give each one a distinct name unless overwriting is actually what you want.

Placeholder syntax mismatch. This pack ships more than one templating node, and they don't all use the same placeholder style - Format Text uses Python's {name} braces, while Short String Format uses $(name). Mixing them up means your placeholder just prints literally instead of getting replaced, with no error to tell you why.

Thin community support. This is a small, low-traffic pack from a solo dev - you won't find much troubleshooting chatter for it out there if something goes sideways, so budget time to read the source yourself rather than expecting a Reddit thread to already have your answer.

CategoryDoubTech/Variables

Inputs (3)

NameTypeDefaultDescription
variableSTRING
valueSTRING
clipCLIP

Outputs (2)

NameTypeDescription
CLIPCLIP
STRINGSTRING