Slider
An interactive control that lets users select a value from a range by dragging a handle horizontally or vertically. It supports precise adjustments for settings.
Installation
Install the component via the CLI in one command.
npx shadcn@latest add @intentui/slider
Composed components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
Manual installation
Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.
npm install react-aria-components tailwind-merge
Examples
Step
Set a step value on the slider, and it will increment or decrement by that fixed amount each time you adjust it.
Range
By passing an array to the defaultValue or value props, you can create a range slider.
Orientation
You can change the orientation of the slider to vertical.
Suffix and prefix
Sometimes you need to add a prefix or suffix to the slider, like a volume icon.
Description
Add a description to the slider.
Controlled
You can control the slider's value by using the value prop.
Disabled
When the slider is disabled, it appears grayed out and becomes non-interactive.
Component API
Slider
The Slider component lets users select values from a range.
| Prop | Type | Default |
|---|---|---|
className | string | - |
SliderFill
The SliderFill component renders the filled portion of the slider track.
| Prop | Type | Default |
|---|---|---|
className | string | - |
SliderGroup
The SliderGroup component groups slider controls.
| Prop | Type | Default |
|---|---|---|
className | string | - |
SliderOutput
The SliderOutput component displays the current slider value.
| Prop | Type | Default |
|---|---|---|
className | string | - |
SliderThumb
The SliderThumb component renders a draggable slider handle.
| Prop | Type | Default |
|---|---|---|
className | string | - |
SliderTrack
The SliderTrack component renders the slider track.
| Prop | Type | Default |
|---|---|---|
className | string | - |
See the React Aria for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.