Slider
Interactive control for selecting a value or range from a continuous scale
The slider lets users pick a value, or a range, by dragging a thumb along a track. Use it for volume, brightness, price ranges, and other continuous settings where quick adjustment matters more than typing an exact number.
Preview
Installation
Usage
Composition
SliderLabel and SliderValue are optional children that render above the track, so a header row (the label and value side by side) sits directly above the slider control:
For content below the track, render it as a sibling of Slider rather than a child (for example, a <FieldDescription> inside the enclosing <Field>).
Examples
Controlled
Use value and onValueChange to control the slider state.
Range Slider
Pass an array value to render two thumbs and select a range.
With Steps
Use step to snap to discrete values, and showSteps to mark them on the track.
With Value Display
Add SliderValue to show the current value beside the slider.
Vertical Orientation
Set orientation="vertical" to lay the slider out vertically.
Variants
Use variant to change the slider's visual style.
| Variant | Description |
|---|---|
default | A round thumb centered on the track. |
contained | The thumb aligns to the track edges at min and max. |
squareThumb | A square thumb in place of the round default. |
With Reference Scale
Render annotations like a reference scale as a sibling of Slider. Content outside the Slider root doesn't need slider context, so it skips the label/value composition rules; a SliderLabel child still keeps the visible label above the track.
Disabled State
Set disabled to prevent interaction.
Form Integration
Slider works with two submission flows. With Base UI's onFormSubmit, values come from registered Fields, so wrap each slider in <Field name="..."> (and compose with Fieldset for multi-thumb groups so each thumb keeps its own aria-label under a shared legend). With a native onSubmit, Slider's hidden input makes name sufficient on its own. The example below shows both. See the Forms guide for more patterns.
Accessibility
The slider is operable from the keyboard: focus a thumb, then use the arrow keys to adjust by step, Home/End to jump to the min and max, and PageUp/PageDown for larger increments.
Give the slider an accessible name when there is no visible SliderLabel. For a range slider, use getAriaLabel so each thumb gets its own label.
API Reference
Slider
Additional Props
Slider inherits all props from Base UI Slider, including orientation, step, value, defaultValue, onChange, and accessibility props.