Widgets/Storage
Variable Widget
Variable Widget
A "Storage" type widget. Variable Widget stores and manages named variables within a workflow. It allows setting and retrieving variable values, supporting both reactive (auto-update) and manual modes. It can be used to share data between widgets or maintain state across a recipe.
Inputs
- set (DataType: Configurable) Sets the variable to the provided value. The data type is determined by the widget's configuration.
- read (DataType: Anything) Triggers the widget to output the current value of the variable.
Outputs
- value (DataType: Configurable) Transmits the current value of the variable. The data type matches the widget's configuration.
Custom Settings
The settings panel provides the following options:
-
Name: The unique name for the variable within your workflow (default:
myVar).- How it works:
- Used to reference the variable in other widgets.
- To define a variable, type a name in the field and press Enter to save it.
- Then, open the widget settings (gear icon) to choose the variable type (e.g., number, string) from the 'Type' menu.
- How it works:
-
Name Dropdown: When entering the variable name, a dropdown appears to help you select from existing variable names. This makes it easy to reuse or reference variables already defined in your workflow.
-
Type: Choose the kind of data the variable will store: String, Number, Array, Object, or Image. The type you select determines what kind of data the variable can store and what type the input/output ports will accept and transmit.
-
Default Value: Set an initial value for the variable. It will be used if no value is provided during workflow execution.
- Note: The default value option is only available when the variable type is set to String or Number.
-
React to Value Changes (Reactive): Controls whether the variable widget automatically notifies other widgets of changes, or waits for a manual trigger to do so.
- Enabled: The widget will transmit the new value to connected widgets every time it is updated (reactive mode).
- Disabled: The widget will only output its value when explicitly triggered via the read input port (manual mode).

📌 Important Notes
- To test the example, make sure to save the
usernamevariable first. The flow won't run correctly unless the variable is saved.
Example
This example shows how a value can be stored in a Variable Widget and automatically updated in connected widgets using the "React to value changes" option.
Drag the example onto the workspace to explore and experiment!
In this example:
- The Button widget triggers the Text widget through the
triggerport - The Text widget transmits the string "Johnas" to the first Variable widget through the
setport - The first Variable widget stores the value in the
userNamevariable and, because it's reactive, automatically transmits the value to the second Variable widget - The second Variable widget receives the value and transmits it to the Text widget through the
setTextport for display
📌 Additional Notes
- The Variable Widget is ideal for sharing state or values between widgets in a workflow
- If the variable is set to reactive, it will automatically output its value when changed
- The variable's type and default value can be configured in the settings
- Use unique variable names to avoid conflicts in complex workflows
Glossary
-
Recipe
A configuration file that defines a complete visual programming workflow, including all widgets, their connections, and settings.
-
Workflow
A sequence of connected widgets that process data and perform actions in Kemu's visual programming environment.