Nodes/ComfyUI-JNodes/String Literal
ComfyUI Node

String Literal

A plain multiline text box you can wire anywhere

By JaredTherriault·Created 3 years ago·Updated about a month ago· 91
String Literal
    • STRING
    string

    This is a text box. That's it - a multiline field that outputs whatever you type as a STRING. It sounds too simple to need a node, and honestly it kind of is, but "a string I can define in one place and wire into several" turns out to be one of those primitives you reach for constantly once you build graphs of any size.

    The use case: you've got a prompt fragment, a shared style suffix, or a filename base that shows up in multiple spots. Put it in a JNodes_StringLiteral and fan the output out to every node that needs it. Now there's one place to edit instead of five copies to keep in sync. It's the string equivalent of declaring a constant. It also works fine as a labeled note or a scratch input while you're wiring things up.

    How it works

    There's no processing. You type into the string field, the node emits exactly that text on its STRING output. Multiline is on, so newlines are preserved - paste in a whole block if you want. What comes out is byte-for-byte what you put in.

    The inputs and outputs

    • string (multiline STRING) - the text you type. That's the only input.
    • STRING output - the same text, ready to plug into any string input: a CLIP text-encode, a filename field, a search-and-replace node, whatever.

    Worth knowing: JNodes also has JNodes_SyncedStringLiteral, which is this node's fancier cousin - it syncs the text with an external .txt file so you can save and load from disk. If you want your text to live in a file you can edit outside ComfyUI, that's the one. JNodes_StringLiteral keeps the text inline in the graph, which is what you usually want.

    How to install it

    Via ComfyUI Manager: Install Custom Nodes, search "JNodes", install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/JaredTherriault/ComfyUI-JNodes
    pip install -r ComfyUI-JNodes/requirements.txt
    

    then restart ComfyUI. No model downloads. It's part of the broader JNodes suite Jared Therriault has been building since 2024, but this node is as featherweight as they come.

    Common issues & troubleshooting

    It doesn't parse anything. Whitespace, trailing commas, weird spacing - it all comes out exactly as typed. If you're building a prompt by hand and want the leading/trailing whitespace cleaned up, feed the output through JNodes_TrimAndStrip, or use JNodes_SplitAndJoin to collapse extra spaces and commas. This node is deliberately dumb; the cleanup nodes are separate.

    If you need the text to survive outside the graph, use the synced version. JNodes_StringLiteral stores its text as part of the workflow. That's perfect for something you edit right there in the node, but if you want a prompt library you can manage in a text editor, JNodes_SyncedStringLiteral with a path_to_synced_txt is the better fit.

    It's a string, so downstream type matters. The output is text. If you plug it into a node expecting a number and the string isn't a valid number, you'll get a graph error - that's on the receiving node, not this one. For numeric constants, reach for JNodes_IntLiteral instead.

    That's the whole story. It's not clever, and it doesn't try to be - it's a clean, centralized place to hold a piece of text, and that's exactly why you'd use it.

    Categorysd

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING