ComfyUI Node

String Literal

A text box that insists on staying on one line

By teward·Created 2 years ago·Updated 2 years ago· 9
String Literal
    • STRING
    string

    Some strings are data, not prose. A filename, a tag, a token, a value you want to shove into some node that expects a single line of text. That's the entire reason HelperNodes_StringLiteral exists: a text field that refuses to go multiline, and one STRING output to carry whatever you typed.

    It sounds like the most disposable node imaginable, and for most graphs it is. But it earns its place in one recurring ComfyUI situation: you need a small piece of text somewhere on a wire, and you'd rather see it as a standalone, labeled node than buried in the widget of some other node where it's easy to miss. Give it a name, type a string, and the value rides the wire into anything with a STRING input.

    How it works

    One field, zero cleverness. string is a required STRING input with multiline disabled, so pressing Enter does nothing - by design. The node returns it unchanged as the STRING output. That's the mechanism. The pack splits this from its multiline sibling (HelperNodes_MultilineStringLiteral) precisely so the constraint is visible in the node's shape: you can't accidentally paste a wall of text somewhere it'll break a parser.

    Inputs and outputs

    • string - required, single-line STRING.
    • STRING output - the same text, typed STRING.

    The honest take

    Be honest with yourself about whether you need this. If you're just holding a prompt, use HelperNodes_Prompt or CLIP Text Encode - those are multiline for a reason. Reach for the single-line literal when a node downstream needs a short, exact value and you want it legible in the graph. In practice that's mostly filenames, folder names, tags, and one-off tokens. It's a ten-second addition that removes a recurring annoyance; that's a good trade even for a node this humble.

    Install

    ComfyUI Manager → search ComfyUI-Helper-Nodes, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/teward/ComfyUI-Helper-Nodes
    

    Restart after. The pack adds piexif and whratio beyond ComfyUI's built-in numpy/pillow; Manager installs them. No models involved.

    Troubleshooting

    The only failure mode worth naming is expectation mismatch: if you paste multiline text in, it doesn't error, it just sits there as a single line when it hits downstream - so if something downstream looks truncated, that's why. Otherwise there's nothing to break in a node this simple.

    CategoryComfyUI-Helper-Nodes/util

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING