Reference
Slider
Range input. aria-* and its other attributes reach the input; with aria-valuetext the raw number is not shown beside the track.
Slider(bind: State, min: Number, max: Number, …)
Before 5.0
min
max
step
range
label
disabled
Volume: 60%
Example
state volume = 60
Slider(bind: volume, min: 0, max: 100, step: 5, label: "Volume")
Text("Volume: {volume}%").muted
A range, with two thumbs
state price: [Number] = [20, 80]
Slider(bind: price, min: 0, max: 200, step: 10, label: "Price").range
Text("From ${price[0] ?? 0} to ${price[1] ?? 0}")
Disabled
state brightness = 40
Slider(bind: brightness, min: 0, max: 100, label: "Brightness").disabled
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
bind: | State | The | |
min: | Number | 0 | The value at the start of the track |
max: | Number | 100 | The value at the end of the track |
step: | Number | 1 | How far one move of the thumb, or one arrow key, changes the value |
range: | Bool | false | Two thumbs, a low and a high that cannot pass each other: |
label: | String | none ( | The label drawn above the track and the input's accessible name; with |
disabled: | Bool | false | Whether the control is inert: it cannot be focused or changed, and a form does not send it. Written as a flag, |
Attribute families: global, aria, data, input. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.
Flags and cases
A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.
.range
.disabled
Events
The DOM events it is drawn to answer. Any other DOM event works too, in an on … { } handler.
| Event | Sends | Meaning |
|---|---|---|
on input | DOM | The value changed, on every keystroke |
on change | DOM | The value was committed |
Every element also takes the props, the events and the attribute families listed on every element.
Slots
It takes no slots.
Renders with the class wf-slider, stable across releases, so a stylesheet may target it.