Nodes/KJNodes for ComfyUI/Widget To String
ComfyUI Node Runs on cloud

Widget To String

Pull any node's setting out as text

By kijai·Created 3 years ago·Updated about 16 hours ago· 2,930
Widget To String
  • any_input
  • STRING
id0
widget_name
return_allfalse
node_title
allowed_float_decimals2

WidgetToString grabs the value sitting in another node's widget - the seed, the steps, the CFG, the prompt text, whatever - and hands it to you as a plain string. Why would you want that? So you can bake your generation settings into the filename, stamp them onto a caption, or display them for reference. It's a small metadata-plumbing node, the kind of thing you don't think about until you're trying to remember which seed produced the good image and wishing it were written on the file.

How it works

Every node in ComfyUI has widgets - the little input boxes and dropdowns on its face. This node reaches into a specific node, reads a named widget's current value, and outputs it as text. It identifies the target node either by its numeric ID or by a title you gave it, then pulls the widget you name.

The inputs

Read the node's own tooltip carefully, because targeting is the fiddly part:

  • id - the numeric ID of the node you're reading from. IDs aren't shown by default; turn on Node ID Badge Mode in ComfyUI's main settings to see them.
  • widget_name - which widget to read. It can be a single name or a comma-separated list to grab several at once (e.g. seed, steps, cfg).
  • return_all - a boolean; when on, it returns every widget value rather than just the one(s) you named.
  • any_input (optional) - the node's description is explicit that this exists to make sure the target node is actually present in the workflow. If you leave id and node_title blank, it reads from whatever node feeds this input.
  • node_title (optional) - target by title instead of ID. Note the catch spelled out in the tooltip: node titles only exist if you manually renamed the node. A default-named node has no title to match.
  • allowed_float_decimals (optional) - how many decimal places to keep when the value is a float.

The output is a single STRING.

What people use it for

Filename stamping is the big one - wire the seed and steps into a save node's prefix so every file self-documents. Captioning is another: pull the positive prompt out and write it to a sidecar for a dataset. And it's genuinely useful for debugging, letting you surface a buried setting as text so you can see it without hunting through the graph.

Installing KJNodes

ComfyUI Manager: Custom Nodes Manager, search "KJNodes for ComfyUI", install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt (portable: python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-KJNodes\requirements.txt), restart. No downloads.

Gotchas

Targeting is where everyone gets stuck. If you're using node_title, remember titles only exist when you've manually renamed the node - otherwise there's nothing to match and you get nothing back. If you're using id, enable Node ID Badge Mode first so you're reading the right number, and be aware IDs can shift if you rebuild parts of the graph.

And the widget_name has to match exactly. It's the internal widget name, so seed, steps, cfg, text, and so on - misspell it or guess the wrong label and the node can't find it. When in doubt, flip on return_all to dump every widget and see the real names before narrowing down.

CategoryKJNodes/text

Inputs (6)

NameTypeDefaultDescription
idINT00–100000
widget_nameSTRING
return_allBOOLEANfalse
any_inputopt*
node_titleoptSTRING
allowed_float_decimalsoptINT20–10Number of decimal places to display for float values

Outputs (1)

NameTypeDescription
STRINGSTRING