shadcn.io is not affiliated with official shadcn/ui
Slider examples · Styled
With Gradient Track Slider for React
A Heat slider on a track that fades from a cool color to a hot one.
The track itself shows the scale. It fades from the theme's info color to its destructive color, and the range is transparent so the gradient shows end to end. Use it for heat, intensity or any cold-to-hot scale.
Preview
Installation
FAQ
How is the gradient drawn?
The slider's class gives the part with data-slot="slider-track" bg-linear-to-r from info to destructive, and the range bg-transparent.
How does the readout follow the thumb?
The value lives in state, starting at 70, and goes back to the slider as value. The number beside the label prints it with a degree sign.
onValueChange receives the new value, and the handler stores it as an array.
Can I change the colors?
Change the from- and to- classes. Theme tokens keep it working in dark mode.
Related
- Colored SliderA Success Rate slider whose fill and
- Minimal Style SliderAn Intensity slider drawn as an outlined
- Simple SliderA single-thumb slider with no label or
- With Live Preview SliderA Border Radius slider from 0 to 50px
- Gradient ProgressA progress bar at 65 percent whose fill
- With Tooltip SliderA Progress slider with a bubble above the