Components

Slider

Lets users select a single value or a range from a continuous scale by dragging a thumb along a track.

Basic usage

Pass a single-element defaultValue array for an uncontrolled single-thumb slider.

Range

Provide two values to render two thumbs that define a lower and upper bound — ideal for price or date ranges.

Steps & disabled

Use step to snap to coarser increments, and disabled to make the control read-only.

Props

PropTypeDefaultDescription
defaultValuenumber[][min, max]Uncontrolled starting value. Pass one number for a single thumb or two for a range.
valuenumber[]Controlled value. When set, you must update it via onValueChange.
onValueChange(value: number[]) => voidFires continuously as the thumb is dragged or moved with the keyboard.
onValueCommit(value: number[]) => voidFires once when the user finishes interacting (pointer up / blur).
minnumber0Minimum allowed value.
maxnumber100Maximum allowed value.
stepnumber1Stepping interval the thumb snaps to.
orientation'horizontal' | 'vertical''horizontal'Layout direction of the track.
disabledbooleanfalsePrevents interaction and reduces opacity to 50%.
classNamestringAdditional Tailwind classes to merge onto the root.
...restSliderPrimitive.Root propsAll Radix Slider root props are forwarded.

Accessibility

  • Built on Radix UI Slider — each thumb is a focusable element with role="slider" and the correct aria-valuemin, aria-valuemax, and aria-valuenow.
  • Fully keyboard operable: Arrow keys move by one step, Page Up/Page Down by a larger amount, and Home/End jump to the bounds.
  • Each thumb shows a visible focus-visible ring using the brand gold ring token for keyboard navigation.
  • When no visible label is present, associate the slider with descriptive text via aria-label or aria-labelledby so screen reader users know what it controls.