Slider
An input where the user selects a value from within a given range.
Made by shadcnInstallation
Loading component...
Range
Loading component...
Vertical orientation
Loading component...
Disabled
Loading component...
Live value label
Loading component...
Custom step increments
Loading component...
Formatted value
Loading component...
Drag bubble
Loading component...
Custom min, max, and step
Loading component...
When to use
Sliders allow users to select a value from a range. Use this decision tree:
Usage
import { Slider } from "@/components/ui/slider"<Slider defaultValue={[33]} max={100} step={1} />Props
Keyboard interactions
| Key | Action |
|---|---|
Tab to thumb | Focus lands on the thumb. Range sliders have one thumb per value. |
ArrowLeft / ArrowDown | Decreases value by one step. |
ArrowRight / ArrowUp | Increases value by one step. |
PageDown / PageUp | Decreases / increases by a larger step (roughly 10% of the range). |
Home / End | Jumps to min / max. |
Accessibility
- Each thumb exposes
role="slider"witharia-valuemin,aria-valuemax, andaria-valuenow. Always provide a programmatic label (<Label>+aria-labelledby, oraria-label) describing what the value represents. - Pair the slider with a visible numeric value where precision matters — sliders alone are hard to read for screen-reader and low-vision users.
onValueChangereceivesnumber[](always an array, even for single-thumb sliders) — unwrap withvalue[0]when you only need a scalar.- Range sliders enforce
minValue[i] <= value[i] <= value[i+1] <= maxValueautomatically; you don't need to clamp in user land.
Credits
- We use Base UI for the slider component.
- We take our inspiration from Shadcn UI for the slider style.
Recent changes
- patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
- minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
- minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
- majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
- minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
Built by malinskibeniamin. The source code is available on GitHub.