Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Slider examples · Standard

Simple Slider for React

A single-thumb slider with no label or readout, starting at 50.

Framework
UI library

The plainest slider: a track and one thumb, with nothing around it. It starts at 50 and keeps its own value. Use it where the context already says what it sets, such as a row in a settings list.

Preview

Preview width

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

Where does the value live?

Inside the slider. It starts at 50 from defaultValue, and nothing outside reads it. Make it controlled when something else needs the number.

What range does it cover?

0 to 100 in steps of 1, the defaults. min and max set the ends.

How is it named without a label?

With aria-label set to Value, so screen readers still announce something. Use a word that says what it sets, such as Volume. On Base UI, aria-label is one string on the slider.

Can I move it from the keyboard?

Yes. The thumb takes focus with Tab. The arrow keys move it by one step, Page Up and Page Down by a larger step, and Home and End jump to the ends.

How wide is it?

It fills a w-full max-w-md wrapper. The track stretches to the wrapper's width.

Does it submit with a form?

Give it a name and its value goes with the form. It renders a hidden input per thumb.