Slider

Sets one continuous value by dragging along a track.

Volume64%
Rotation12°
Price range190 USD 800 USD

Configurations

Supported configurations for this component.

States

Interaction states covered by the API and the style contract.

Configurations

5 examples
Live
Volume64%
Rotation12°
Price range190 USD 800 USD
Default
md
lg
Labelled
Volume64%
md
Volume64%
lg
At minimum
md
lg
Two thumbs
Price range190 USD 800 USD
md
Price range190 USD 800 USD
lg

States

3 examples
Hover
64
Rest
64
Hover
Focus visible
64
Rest
64
Focus visible
Disabled
64

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

PropTypeDefaultDescription
valuenumber-Controlled value.
defaultValuenumber-Uncontrolled initial value.
minnumber0Minimum value of the range.
maxnumber100Maximum value of the range.
stepnumber1Increment the value snaps to.
onValueChange(next: number) => void-Handler called with the new value on drag or keyboard change.
labelstring-Optional uppercase sans label.
size'md'|'lg''md'Rung on the shared control ladder, which starts at md here — an sm slider is too small a drag target. Scales the track row, thumb and readout together.
showValuebooleantrueRender the numeric readout next to the label.
showScalebooleantruePrint `min` and `max` under the track ends, the domain the fill is a proportion of. Turn it off for a slider whose range is already obvious from its surroundings.
unitstring-Optional unit suffix (e.g. "%", "KM").
disabledbooleanfalseDisables interaction and dims the slider.
classNamestring-Additional classes for the root wrapper.
styleReact.CSSProperties-Inline styles merged onto the root wrapper.
idstring-Id for the slider track; auto-generated when omitted.

More Andromeda Pro components