shadcn.io is not affiliated with official shadcn/ui
Slider examples · Settings
Brightness Control Slider for React
A Brightness slider with a sun icon, a warning-colored fill and its percentage beside the label.
A settings slider that looks like what it controls. A sun icon sits before the Brightness label, the fill uses the theme's warning color, and the percentage updates as it moves. Use it in display or camera settings.
Preview
Installation
FAQ
How is the fill colored?
The slider's class sets bg-warning on the part with data-slot="slider-range" and border-warning on the thumb. It follows the theme, light or dark.
How does the readout follow the thumb?
The value lives in state, starting at 80, and goes back to the slider as value. The percentage beside the label prints it.
onValueChange receives the new value, and the handler stores it as an array.
Is the sun icon announced?
No. It has aria-hidden="true"; the Brightness label and the slider's aria-label carry the meaning.
Related
- Volume Control SliderA Volume slider with a speaker icon and
- Temperature Control SliderA Temperature slider from 16°C to 30°C on
- Speed Control SliderA Speed slider with four steps, from Slow
- Simple SliderA single-thumb slider with no label or
- Slider with LabelA slider with a Volume label above the
- Synced with Input Field SliderA slider and a number field that share