shadcn.io is not affiliated with official shadcn/ui
Slider examples · Range
Range with Value Display Slider for React
A two-thumb slider with the selected range written beside its label.
Framework
UI library
The range reads at a glance without looking under the track. The two values sit beside the Range label in one row. Use it where vertical space is tight.
Preview
Installation
Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
FAQ
How does the readout follow the thumb?
The value lives in state, starting at [30, 70], and goes back to the slider as value. The text beside the label prints both values with a dash between them.
onValueChange receives the new value, and the handler stores it as an array.
How is the row laid out?
flex items-center justify-between: the label at the start, the values at the end in muted tabular-nums text.
Related
- Basic Range SliderA two-thumb slider for picking a range
- Price Range SliderA two-thumb price slider from $0 to $1000
- Range with Constraints SliderA two-thumb slider whose thumbs always
- Percentage Range SliderA two-thumb percentage slider that steps
- Slider with LabelA slider with a Volume label above the
- Input with LabelA text input with a label above it