Slider
npx shadcn add @klarhimmel/sliderCopy for AIExamples
Basic
States
Form
DetailsAbout, usage, props and more
A single-value slider on the native range input.
When to use
Use for
A rough value on a range where the position says more than the number.
Not for
An exact figure. Use Input type number. A choice among named options. Use Radio group.
Pairs with
Label and a visible output next to it.
Preview
Import
Import
- Files
- slider.tsx, in components/klarhimmel/ui/. With it: theme, utils.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | - | Required unless a <label htmlFor> names it. |
min | number | 0 | The range and its steps. |
max | number | 100 | The range and its steps. |
step | number | 1 | The range and its steps. |
native attributes | InputHTMLAttributes | - | Every native attribute of the element passes through, className included. |
Accessibility
| Key | Does |
|---|---|
Left / Down | Decreases by one step |
Right / Up | Increases by one step |
Page Down / Page Up | Moves in larger steps |
Home / End | Minimum or maximum |
Native range input: the keys and the slider role are the browser's. Always show the current number next to it.
Accessibility