Slider
Pick a value or a range by dragging or with the keyboard, with the value always readable.
Base UI reference ↗Installation
Run it from the root of a project already set up with zunoui init.
npx zunoui@latest add sliderDependencies
What add slider installs alongside the component. The CLI skips any you already have in a compatible version.
ZUNO registry
@zuno/utils
npm
@base-ui/[email protected]
Examples
3 examples · 1 componentLabel and value
SliderLabel names the thumb; SliderValue shows and announces the value.
Price range
Two thumbs, each with its own name, formatted as currency.
Steps and disabled
step="25" snaps to quarters; disabled blocks interaction.
API reference
Keeps the props, events and refs of the matching Base UI primitive, plus ZUNO's styles.
| Prop | Type | Default |
|---|---|---|
value / defaultValueAn array renders one thumb per value (a range). | number | number[] | — |
onValueChange / onValueCommittedWhile dragging, and once when released. | (value) => void | — |
min / max / stepBounds and increment; Page Up/Down moves by largeStep. | number | 0 / 100 / 1 |
format / localeHow SliderValue and screen readers present the value (currency, percent…). locale defaults to en-US so SSR and the client agree. | Intl.NumberFormatOptions / string | — / "en-US" |
thumbLabelsOne accessible name per thumb for ranges. | string[] | — |
orientationVertical sliders need a height (h-40 by default). | "horizontal" | "vertical" | "horizontal" |
disabledDims the slider and blocks interaction. | boolean | false |
SliderLabel / SliderValueLabel wired to the thumbs, and the live formatted value. | div / output | — |
States
The states that apply to this component and their visual treatment.
| State | Treatment |
|---|---|
| Idle | Track in muted, filled part and thumb ring in primary. |
| Dragging | The value and output follow the pointer. |
| Focus | Offset outline on the focused thumb. |
| Range | Two thumbs; they cannot cross. |
| Disabled | Dimmed with a not-allowed cursor. |
Accessibility
Each thumb is a native range input: arrows change by step, Page Up/Down by a larger step, Home/End jump to the bounds.
SliderLabel names a single thumb; ranges need thumbLabels so each thumb says which end it controls.
SliderValue is an <output> and format shapes both what is shown and what is announced ("$250", not "250").
The control is 24px tall and the whole track is clickable, so small thumbs stay easy to reach.