Skip to content

Slider

Single-thumb slider built on React Aria; supports marks, value readout, and locale-aware formatting.

  • stable
  • since v0.1.0
  • 1.1 kB
  • forms

Thumb exposes role="slider" with aria-valuemin/max/now; arrow keys move by step, Home/End jump to bounds.

Preview
Open
tsx

Three track sizes are available: sm, md (default), and lg.

Preview
Open
tsx

Set showValue to render the current value in the header.

Preview
Open
tsx

Use step to constrain motion to discrete increments.

Preview
Open
tsx

Pass an array of { value, label } to render tick marks beneath the track.

Preview
Open
tsx

Pass formatOptions to format the value as currency, percent, or other units.

Preview
Open
tsx
Preview
Open
tsx
PropTypeDefaultDescription
label
ReactNode
Visible label rendered above the track. Also used as the thumb's accessible name when a string.
size
"sm"|"md"|"lg"
"md"
Track size.
marks
readonly SliderMark[]
Tick marks along the track.
showValue
boolean|"tooltip"
Show the current value (or `'tooltip'` to show it on the thumb only).
formatOptions
NumberFormatOptions
Intl format options passed to React Aria for locale-aware display. The display format of the value label.
className
string
style
CSSProperties
  • The thumb exposes role="slider" with aria-valuemin, aria-valuemax, and aria-valuenow.
  • Arrow Left/Right (or Up/Down) move by step; Page Up/Down move by a larger increment; Home/End jump to bounds.
  • When label is a string it is forwarded as aria-label on the thumb.
  • Always provide a label or aria-label so the slider’s purpose is announced.
  • Use whole-number step for counts; fractional step for percentages or weights.
  • Pair showValue with formatOptions to keep the readout consistent across locales.
  • Use marks to surface meaningful waypoints (e.g. tier breakpoints) along the track.