Forms
Slider
Pick a value or a range on a track.
Single value
Drag the thumb, click the track, or use the keyboard. Values are always an array: [40] is one thumb. A value bubble shows while dragging or when the thumb is focused with the keyboard.
Volume40%
When to use
- Choosing a value on a continuous or finely stepped scale where the rough position matters: volume, brightness, a price filter.
- Choosing a range between two values, with two thumbs that cannot cross.
Not for: an exact number the user must type (use a number input), or a handful of named options (use a radio group).
Range
Pass two values for a range. Each thumb has its own name (thumbLabels), and minStepsBetweenThumbs keeps them apart.
Price range$120 – $640
Steps and value text
step snaps the value. formatValue changes the bubble and the aria-valuetext that screen readers announce, so a level reads “High” rather than “2”.
Export qualityArrow keys move one level
Vertical
orientation="vertical" is 12rem tall by default (override with className). The minimum sits at the bottom, and Up increases the value.
API
Slider
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number[] | — | Controlled thumb values. One entry is a single slider; two is a range. |
| defaultValue | number[] | [min] | Initial values when uncontrolled. |
| onValueChange | (value: number[]) => void | — | Called on every change while dragging or using the keyboard. |
| onValueCommit | (value: number[]) => void | — | Called when a drag ends or a key changes the value. Use it to save. |
| min / max / step | number | 0 / 100 / 1 | Range and snapping. |
| minStepsBetweenThumbs | number | 0 | Minimum gap between range thumbs, in steps. |
| orientation | 'horizontal' | 'vertical' | 'horizontal' | Vertical needs a height (12rem by default). |
| formatValue | (value: number) => string | — | Text for the bubble and aria-valuetext. |
| thumbLabels | string[] | ['Minimum', 'Maximum'] | Accessible names for range thumbs. |
| tooltip | 'auto' | 'always' | 'never' | 'auto' | Auto: while dragging, hovered or keyboard-focused. |
| name | string | — | Form field; one hidden input per thumb. |
| disabled | boolean | — | Dims the slider and ignores input. |
| aria-label / aria-labelledby | string | — | Names the slider (a group for ranges). |
| ...props | HTMLAttributes<HTMLDivElement> | — | Forwarded to the root, including ref and className. |
Keyboard
| Key | Action |
|---|---|
| → / ↑ | Increases the focused thumb by one step. |
| ← / ↓ | Decreases the focused thumb by one step. |
| Page Up / Page Down | Changes the value by about a tenth of the range. |
| Home / End | Jumps to the minimum / maximum (or the neighbouring thumb in a range). |
| Tab | Moves between thumbs; each thumb is a tab stop. |
Accessibility
- Each thumb is role="slider" with aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext and aria-orientation (WAI-ARIA slider and multi-thumb slider patterns).
- In a range, each thumb’s min and max are its neighbours’ values, and the pair sits in a role="group".
- Name the slider with aria-label or aria-labelledby; range thumbs get “Minimum” and “Maximum” by default.
- The value bubble is decorative; the value is announced through aria-valuetext.
Motion
- Thumbs follow the pointer exactly, with no easing, so dragging never lags.
- The thumb grows to 1.12 on the snappy spring while held; the bubble rises 4px and sheds a 2px blur.
- Touch: vertical page scroll still works across a horizontal slider; a horizontal drag moves the thumb.
- Reduced motion: the bubble and thumb change state without movement.