Slider
Interactive control for selecting a value or range from a continuous scale
Primitive
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 label and value side by side make a header row:
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; markStep spaces the marks wider than step, and showSteps="hover" shows them only while the slider is in use. Dragging follows the pointer between steps, and the thumb settles on the nearest one when you let go.
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. |
inset | A tall track with a handle that sits inside the fill. |
bar | A tall track with a thin bar handle just inside the fill's end, and optional startLabel and endLabel text. |
squareThumb | A square thumb in place of the round default. |
Bar With Value
Pass SliderValue as endLabel to show the live value inside the track, formatted by the slider's format prop. The labels are decorative, so still name the slider with getAriaLabel or a SliderLabel.
Color
Use color="primary" to fill the range with the brand color instead of the default emphasis grey that checked checkboxes, radios, and switches share.
With Reference Scale
Render a reference scale as a sibling below Slider, where it needs no slider context; a SliderLabel child still sits 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
The Slider is built on top of Base UI's Slider. All Base UI props are supported except thumbAlignment, which the variant sets. The documentation below only covers custom props and the props our implementation handles.
For the complete Base UI API, see the Base UI Slider documentation.
Props
Slider
Track, fill, marks, and thumbs for one value or a range. Composes Base UI's Slider.Root, Slider.Control, Slider.Track, Slider.Indicator, and Slider.Thumb. Props are forwarded to Slider.Root.
SliderValue
The current value as text, formatted by the slider's format prop. Wraps Base UI's Slider.Value.
SliderLabel
The slider's visible label. Wraps Base UI's Slider.Label.
Upgrading
If you're reinstalling over an earlier version, check these changes:
| Before | Now |
|---|---|
| Range and thumb in the primary blue | A color prop, neutral by default. Pass color="primary" for the brand fill. |
variant="contained" | Removed. Use variant="inset", a tall track with the handle inside the fill. |