Skip to content
MyAppBuilder
StableAction

Set state

Overview

Stores a value in app state, page state or a component's state, so other components can react to it.

Purpose

State is your app's short-term memory: the selected tab, a filter value, a “show details” toggle, the current step of a wizard. Set it from buttons, inputs (On change) or page load, and bind components to it through the Data Picker.

Inputs

  • State — App state (shared by all pages), Page state (this page only) or Component state (a specific component).
  • Component — for component state: a component that exposes state (tables, forms, inputs, tabs, modals and drawers…).
  • Key — the variable name. For app state you pick from the variables declared under App state; otherwise type a key such as open, value or page.
  • Value — static or dynamic (Event › value, Form › field, Current record › id, a template…).

Configuration

  • Declare app state variables (with a type and default) under Settings → App state so they appear in the Data Picker and can persist across reloads.
  • To control a component, use its exposed keys: open for a modal or drawer, value for an input, page for a table, activeIndex for tabs and steppers.

Outputs

  • None directly; the new value is readable everywhere as App state › key, Page state › key or Component › key.

Example

Filter a table by status

Example
Dropdown “Status” › On change:
  1. Set state
     State: Page state · Key: status · Value: Event › value

Table filter: Status equals Page state › status

Errors

  • None. Setting a key that no component reads simply has no visible effect.

Limitations

  • Page state starts empty on every visit (it is not restored); use App state with persist for values that must survive reloads.
  • State lives in the browser only — it is never saved to the database.

Advanced

  • Schema: { type: "set_state", scope: "app" | "page" | "component", key, componentId?, value: Binding }. Writes to the runtime Zustand store; app-state keys flagged persist are mirrored to localStorage.

Related

Was this helpful?