Components
Stepped Slider
A slider that snaps to labelled steps.
<SteppedSlider label="Team size" steps={["1", "2–5", "6–20", "21–50", "50+"]} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/stepped-slider.jsonimport { SteppedSlider } from "@/components/stepped-slider"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A slider that snaps between labelled steps shown under the track. Screen readers hear the step's label, such as "2–5", not its position.
import { SteppedSlider } from "@/components/stepped-slider";
export function TeamSize() {
return <SteppedSlider label="Team size" steps={["1", "2–5", "6–20", "21–50", "50+"]} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | The label. | |
steps | string[] | The step labels, left to right. | |
defaultIndex | number | 0 | Starting step. |
onChange | (index: number, step: string) => void | Called when the step changes. | |
color | string | "#6366f1" | Fill and thumb colour. |
className | string | Classes for the wrapper. |
It has no animation, so reduced motion changes nothing.