Skip to content
Konjure / spatial intelligence

Slider

← Builtin reference

A host-rendered numeric control with a typed value action.

Signature

type Slider {
  label: Str = "Slider";
  action: func(Number) -> Res[Unit, DataError] = ignore_number;
  min: Number = 0;
  max: Number = 1;
  value: Number = 0;
}

The host supplies a Number to action. A callback accepting input owns any update to Slider.value; schema construction and host input do not mutate it automatically.

Fields

label: Str
Visible label; defaults to Slider.
Default"Slider"
action: func(f64) -> Res[Unit, DataError]
Typed callback accepting the requested numeric value; defaults to ignore_number.
Defaultignore_number
min: f64
Lower requested bound; defaults to 0. Hosts should present min no greater than max.
Default0
max: f64
Upper requested bound; defaults to 1. Hosts should present max no less than min.
Default1
value: f64
Current requested numeric value; defaults to 0 and changes only through explicit checked state updates.
Default0

Examples

Inspect defaults

The default range is 0 through 1.

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

Expose a changeable control

Change Gain: set_gain clamps the input, updates the stored Slider value, and logs the accepted value.

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

Rust definition

Interpreter RecordValue UI schema; host input dispatch owns actual slider interaction.

See also