Skip to main content

Respond to a press

Keep a local message and change it when a button is pressed.

Before you start: Display data.

state initializes values owned by this instance. on-press runs a handler. set message to 'You pressed the button' changes the message; the bound text is evaluated again. No server request is needed.

Change a local message​

State is initialized once for a logical instance. The label reads the message directly.

<Column state="{message:'Ready'}" class="p-4 gap-3">
<Text bind-text="message" />
<Button title="Press me" on-press="set message to 'You pressed the button'" />
</Column>
Respond to a press
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Press the button, then change the message assigned by the handler. XML edits replace the document and reset local state.

Next: edit a value. Reference: state, set, events.