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.Default
ignore_number min: f64- Lower requested bound; defaults to 0. Hosts should present min no greater than max.Default
0 max: f64- Upper requested bound; defaults to 1. Hosts should present max no less than min.Default
1 value: f64- Current requested numeric value; defaults to 0 and changes only through explicit checked state updates.Default
0
Examples
Inspect defaults
The default range is 0 through 1.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
1
Expose a changeable control
Change Gain: set_gain clamps the input, updates the stored Slider value, and logs the accepted value.
main.kj⌘ / Ctrl + Enter
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
slider ready
Rust definition
Interpreter RecordValue UI schema; host input dispatch owns actual slider interaction.
View Rust documentation →Support: host UI