Text Template (Format)
Prompt assembly with placeholder slots
- input_1
- input_2
- input_3
- input_4
- formatted_text
Text Template (Format) is a string-assembly node with slots. You write a template like "A {subject} in the style of {artist}", wire up to four inputs, and it fills the placeholders and returns the finished string. It's the ComfyUI-native version of an f-string, and it's the node you reach for when a prompt is built from values that change at runtime - a subject from a dropdown, an artist from a LoRA picker, a seed, a resolution.
It sits in the same family as DP_StringFormatter (also in this pack, and honestly near-duplicate - more on that below), but Text Template's selling point is that placeholders can be positional or named, and the inputs accept any type, not just strings. The input_1 through input_4 sockets are wildcard (*), so you can wire numbers in directly and let Python's format machinery stringify them.
How it works
It calls Python's str.format(). You can address inputs three ways in the template: positionally as {0}, {1} … {3}, or by name as {input_1} … {input_4} or the alias {val1} … {val4}. Output is formatted_text.
⚠️ The trap in the default template
Here's a gotcha I'd bet money you'll hit, because it's baked into the shipped defaults. The node starts with the template "A {subject} in the style of {artist}" - but there is no subject or artist key anywhere in this node. The only named slots are input_1–input_4 and val1–val4. So the default template, as shipped, cannot be filled, and the node doesn't crash - it quietly returns the string "Error: 'subject'" (or the error text for whichever placeholder fails first).
Fix it before you do anything else: change the template to use the actual slot names, e.g. "A {input_1} in the style of {input_2}", or "A {0} in the style of {1}". This is exactly the kind of thing that makes a workflow "not work" for no visible reason, because the node reports success by outputting a string - it just happens to be an error string.
Other gotchas
Same story as the sibling String Formatter: any unfillable placeholder doesn't crash the graph, it becomes error text in the output. And because format() is strict, a stray { in your template that isn't a real placeholder throws a KeyError/ValueError that you'll see as "Error: ..." in the output string. If the assembled prompt looks wrong, look at the raw output, not the input wires.
Which formatter to use
If you're starting fresh, DP_StringFormatter is the friendlier pick - five named inputs ({input1} … {input5}), simpler naming, same .format() engine. Text Template's edge is the positional/valN flexibility and accepting non-string inputs. They genuinely overlap; this pack ships a lot of redundancy, and choosing one and sticking with it is the right move.
Installation
ComfyUI Manager, searching "DebugPadawan's ComfyUI Essentials", or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git
Restart ComfyUI. No models, no extra dependencies for this node - pure string formatting.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| template | STRING | A {subject} in the style of {artist} | — |
| input_1 | * | — | |
| input_2opt | * | — | |
| input_3opt | * | — | |
| input_4opt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| formatted_text | STRING | — |