Browse the docs

Slider

A marker stroke with a mustard sticker to grab. The thumb squishes into the paper when pressed and springs back on release; a native range input does the work underneath.

Client componentWCAG AA

Change every prop live in the playground.

Props

PropTypeDefaultWhat it does
labelrequiredReactNode—Visible label associated with the native range input.
defaultValuenumberthe midpoint of min and maxUncontrolled initial value.
formatValue(value: number) => stringnoneFormat the displayed value and aria-valuetext, e.g. v => `${v}×`.
maxnumber100Highest value.
minnumber0Lowest value.
onValueChange(value: number) => voidnoneCalled with the new numeric value after the native onChange event.
seedstring | numbergenerated from useIdStable imperfections, shared by server and client.
showValuebooleanfalseDisplay the value beside the label.
stepnumber | "any"1Step measured from min, or `any` for continuous values.
ticksnumber | booleanfalseRuler ticks under the track: `true` marks every step (or tenths past 20 steps), a number sets how many gaps.
tone"ink" | "tomato" | "mustard" | "mint" | "periwinkle" | "bubblegum"inkMarker color of the filled part.
valuenumbernoneControlled value.

Also takes every attribute of <input type="range"> (298 more, e.g. onClick, className, aria-*).

Use it well

DoUse it for approximate adjustments like volume, pressure or corner radius. Give every slider a visible label; use formatValue to explain units.
Don'tUse a slider for precise data entry or implement a second keyboard interaction. The native range already handles arrows, Home and End.

Accessibility

  • A native input type=range with an associated visible label. min, max and step define its values; the last step never exceeds max.
  • Tab focuses the input. Arrow keys adjust it and Home/End reach the bounds using the browser's built-in behavior.
  • formatValue sets aria-valuetext even when showValue is false. The visible value is decorative, avoiding duplicate live announcements.
  • A 44px-high input supports pointer and touch dragging. Disabled sliders leave the tab order; name and form work with native forms.
  • Ruler ticks and the fill color are decorative and hidden from screen readers; the value is announced by the native input.
  • Surface text tokens keep labels readable in all light/dark surfaces. Reduced motion removes thumb transforms and transitions; forced colors restore the native range appearance.
Five stamps!

All aboard.

You took the whole tour. Here's Holo Pip, a foil sticker for riders who finish. It's in your playground tray now, for good.