ComponentsForms
Slider
Pick a number or a range by dragging or with the arrow keys.
Pick a number or a range by dragging or with the arrow keys.
<Slider defaultValue={[40]} aria-label="Volume" />The same component at all four levels. Pick the one that fits your project; they share tokens, so they mix.
npm i @junco/react @junco/tailwindimport { Slider } from "@junco/react";
<Slider value={[minutes]} onValueChange={([m]) => setMinutes(m)} max={120} step={5} aria-label="Session length" />Two values make two thumbs. Name each one with thumbLabels.
Inside a Field the thumb takes its name from the label.
Minutes of study a day.
Slider#value / defaultValueonValueChangeonValueCommitmin / max / stepthumbLabelsgetValueLabelsizeorientationdisabledclassNames| Prop | Type | Default |
|---|---|---|
value / defaultValueOne number per thumb. | number[] | – |
onValueChangeCalled while dragging or on each key press. | (value: number[]) => void | – |
onValueCommitCalled when the user lets go. | (value: number[]) => void | – |
min / max / stepThe scale. | number | 0 / 100 / 1 |
thumbLabelsAn accessible name per thumb. One thumb can use aria-label instead. | string[] | – |
getValueLabelWhat screen readers say for a value, e.g. "45 minutes". | (value: number) => string | – |
sizeTrack and thumb size. | "sm" | "md" | "md" |
orientationDirection. | "horizontal" | "vertical" | "horizontal" |
disabledNot focusable or draggable. | boolean | false |
classNamesSlot overrides. | { root?; track?; range?; thumb? } | – |
| Key | Action |
|---|---|
| ←→ | Moves by one step (↑ and ↓ too). |
| Page UpPage Down | Moves by ten steps. |
| HomeEnd | Jumps to the minimum or maximum. |