Slider
An easily stylable range input.
API reference
Import the component and assemble its parts:
import { Slider } from '@base-ui-components/react/slider';
<Slider.Root>
  <Slider.Value />
  <Slider.Control>
    <Slider.Track>
      <Slider.Indicator />
      <Slider.Thumb />
    </Slider.Track>
  </Slider.Control>
</Slider.Root>Root
Groups all parts of the slider.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
aria-labelledby | 
  | 
  | |
name | 
  | 
  | |
defaultValue | 
  | 
  | |
value | 
  | 
  | |
onValueChange | 
  | 
  | |
onValueCommitted | 
  | 
  | |
tabIndex | 
  | 
  | |
step | 
  | 
  | |
largeStep | 
  | 
  | |
minStepsBetweenValues | 
  | 
  | |
min | 
  | 
  | |
max | 
  | 
  | |
format | 
  | 
  | |
disabled | 
  | 
  | |
orientation | 
  | 
  | |
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-dragging | Present while the user is dragging.  | |
data-orientation | Indicates the orientation of the slider.  | |
data-disabled | Present when the slider is disabled.  | |
data-readonly | Present when the slider is readonly.  | |
data-required | Present when the slider is required.  | |
data-valid | Present when the slider is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the slider is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the slider's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the slider has been touched (when wrapped in Field.Root).  | |
data-focused | Present when the slider is focused (when wrapped in Field.Root).  | |
Value
Displays the current value of the slider as text.
Renders an <output> element.
| Prop | Type | Default | |
|---|---|---|---|
children | 
  | 
  | |
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-dragging | Present while the user is dragging.  | |
data-orientation | Indicates the orientation of the slider.  | |
data-disabled | Present when the slider is disabled.  | |
data-readonly | Present when the slider is readonly.  | |
data-required | Present when the slider is required.  | |
data-valid | Present when the slider is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the slider is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the slider's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the slider has been touched (when wrapped in Field.Root).  | |
data-focused | Present when the slider is focused (when wrapped in Field.Root).  | |
Control
The clickable, interactive part of the slider.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-dragging | Present while the user is dragging.  | |
data-orientation | Indicates the orientation of the slider.  | |
data-disabled | Present when the slider is disabled.  | |
data-readonly | Present when the slider is readonly.  | |
data-required | Present when the slider is required.  | |
data-valid | Present when the slider is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the slider is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the slider's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the slider has been touched (when wrapped in Field.Root).  | |
data-focused | Present when the slider is focused (when wrapped in Field.Root).  | |
Track
Contains the slider indicator and represents the entire range of the slider.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-dragging | Present while the user is dragging.  | |
data-orientation | Indicates the orientation of the slider.  | |
data-disabled | Present when the slider is disabled.  | |
data-readonly | Present when the slider is readonly.  | |
data-required | Present when the slider is required.  | |
data-valid | Present when the slider is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the slider is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the slider's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the slider has been touched (when wrapped in Field.Root).  | |
data-focused | Present when the slider is focused (when wrapped in Field.Root).  | |
Indicator
Visualizes the current value of the slider.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-dragging | Present while the user is dragging.  | |
data-orientation | Indicates the orientation of the slider.  | |
data-disabled | Present when the slider is disabled.  | |
data-readonly | Present when the slider is readonly.  | |
data-required | Present when the slider is required.  | |
data-valid | Present when the slider is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the slider is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the slider's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the slider has been touched (when wrapped in Field.Root).  | |
data-focused | Present when the slider is focused (when wrapped in Field.Root).  | |
Thumb
The draggable part of the the slider at the tip of the indicator.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
aria-label | 
  | 
  | |
aria-valuetext | 
  | 
  | |
getAriaLabel | 
  | 
  | |
getAriaValueText | 
  | 
  | |
tabIndex | 
  | 
  | |
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-dragging | Present while the user is dragging.  | |
data-orientation | Indicates the orientation of the slider.  | |
data-disabled | Present when the slider is disabled.  | |
data-readonly | Present when the slider is readonly.  | |
data-required | Present when the slider is required.  | |
data-valid | Present when the slider is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the slider is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the slider's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the slider has been touched (when wrapped in Field.Root).  | |
data-focused | Present when the slider is focused (when wrapped in Field.Root).  | |