Skip to main content

String

Per-instance text holder: stores one string locally, with a Length output and optional latch-until-Set behaviour.

String holds a single text value that belongs to this node instance alone — it is not named or shared (for an app-wide named value use Variable2). The value input sets it and savedValue (Value) reads it back; length always reports the stored string's character count. While the saveValue (Set) signal input is unconnected, values written to value apply immediately; once saveValue is connected the node latches: incoming values are held pending and only applied when Set fires — the idiomatic way to snapshot a text field at the moment of a click. Incoming values are cast with JavaScript String(). changed fires only when the stored value actually changes; stored fires after every Set trigger.

When to use it

Use it to hold or snapshot local text: capture a Text Input's current value on submit, keep a reusable literal in one editable place, or derive length for validation. For text shared across components use Variable2 + Set Variable; for computed text use an Expression.

At a glance

CategoryVariables
Type nameString
Available inbrowser, cloud
SSR compatibilitysafe
Provided bynoodl-runtime

Inputs

Values

NameTypeDefaultDescription
runOnChange-valueBooleantrueWhether a new value on Value re-runs this node. On by default; untick to make this input passive so only the control signal runs it
treatEmptyAsEnum (null, empty-string)nullBack-compat for graphs written before Variables were nullable. null (default) keeps a cleared value distinguishable from a real "". Choosing another option restores the pre-NDA-003 coercion for authors who relied on it.
treatUnchangedAsEnum (unchanged, done)unchangedWhat this node reports when the action was valid and there was nothing to do. Unchanged (the default) keeps it a third outcome of its own. Done suits a project whose chains should carry on either way. Completed fires whatever this is set to.
valueString``The empty-value contract (dev-docs/reference/EMPTY-VALUE-CONTRACT.md): undefined abstains and leaves the Variable's stored value untouched. null is a real value — it clears the Variable, is stored, and fires Changed. What "cleared" is stored as is controlled by Treat empty as (null by default).

Signals

NameTypeDefaultDescription
saveValueSignalStores the latest value now. This is additional to Value storing on change; untick Value under Run On Value Change to stop that

Outputs

Values

NameTypeDefaultDescription
lengthNumber0 when the Variable is cleared (savedValue is null) — there is no text to measure, and 0 is what an author reading this as a plain number expects, rather than a thrown error or null itself.
savedValueStringCan be null — a cleared Variable (see value's description) stores and emits null by default, not this type's zero value, unless Treat empty as says otherwise.

Signals

NameTypeDefaultDescription
changedSignalFires whenever the stored value actually changed, however it was reached — including Value writing straight through under Run On Value Change. It is a value-level event, not the outcome of a Set
completedSignalFires after every invocation, whatever the outcome — wire this to carry on regardless. Failure still fires and still carries its reason, so this cannot hide an error
doneSignalFires when a Set stored a value the Variable was not already holding
unchangedSignalFires when a Set stored the value it already held, so nothing changed. ⚠️ With Value left ticked under Run On Value Change this is the common case, because Value has already stored by the time Set fires

Patterns

  • Snapshot on submit: Text Input onTextChangedvalue, Button onClicksaveValue; stored then triggers whatever consumes the committed text.
  • length → an Expression or Condition for 'minimum characters' style validation.

Watch out for

  • Using String nodes in two components to 'share' text — each instance has its own value. Use Variable2 for shared text.

Examples

Share a value between components with Set Variable and Variable

The idiomatic shared-state shape, contrasting per-instance and app-wide storage. In the form component, a String node snapshots the text field: because its saveValue (Set) is connected, keystrokes only latch a pending value, and the Button click commits it. The String's stored signal then fires the Set Variable's do, writing the committed text into the app-wide variable 'userName' (setWith 'string' types the dynamic value input). In a completely separate component, a Variable2 node bound to the same name reads the value reactively — its changed/value update the greeting automatically whenever the variable is written, with no connection between the two components.

Boolean, Number, Color, Variable, Set Variable, Expression, Text Input

Generated

This page is generated from node-catalog-enriched.json. Do not edit it by hand — run npm run docs:nodes to regenerate, and fix the source enrichment instead.