Skip to content
Konjure / spatial intelligence

Button

← Builtin reference

A host-rendered control with a typed no-argument action.

Signature

type Button { label: Str = "Button"; action: func() -> Res[Unit, DataError] = noop; }

The host invokes action through Machine::invoke_component. The default noop is intentional; a Button schema never dispatches an action by itself.

Fields

label: Str
Visible label; defaults to Button.
Default"Button"
action: func() -> Res[Unit, DataError]
Typed zero-argument callback; defaults to noop. Bind a live component method to persist mutations.
Defaultnoop

Examples

Use the default action

The default callback is callable and produces no log output.

Tick 0 · 0.00 s⌘ / Ctrl + EnterThis device
main.kj
Loading the language runtime…
Output 0
No output.
Expected output
Button

Expose a clickable control

The spawned control retains a typed callback for host click dispatch; initialization makes the example's ready state observable.

Tick 0 · 0.00 sThis device
main.kj⌘ / Ctrl + Enter
Loading the language runtime…
Output 0
No output.
Expected output
button ready

Rust definition

Interpreter RecordValue UI schema; host input dispatch owns actual clicks.

See also