Slider
Picks a number from a range, with its label and current value above it and the ends below.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The label and accessible name. | |
value | number | bindable(0) | The number. Bind it with bind:value={name}. |
min | number | 0 | The smallest number. |
max | number | 100 | The largest number. |
step | number | 1 | The distance between numbers. |
unit | string | | Written after each number, such as %. |
disabled | boolean | false | Cannot be moved or focused. |
States
| State | Looks like |
|---|---|
dragging | The thumb follows the pointer; the value updates live. |
focused | The focus outline. |
disabled | The whole part at 50% opacity. |
Accessibility
| role | slider |
| name | The label prop. |
| focus | Tab reaches it; Shift+Tab leaves it. A disabled one is skipped. |
| keyboard | Arrow keys move one step; Home and End jump to the ends. |
Theme tokens
color.primary color.ink color.muted space.1 text.label text.body text.caption
Example
<Slider label="Volume" unit="%" bind:value={volume} />