Slider

A range input with draggable thumbs. Supports single value, ranges (two thumbs), custom steps, and full keyboard control.

Volume33%
Price range$20 – $80

Stepped (step = 10)

Disabled

Installation

pnpm
pnpm dlx @hex-core/cli add slider

Range slider

Two-thumb range

tsx
<Slider defaultValue={[20, 80]} max={100} step={1} />

API Reference

PropTypeDefaultDescription
value
objectControlled array of thumb values (number[]), e.g. [50] for single, [20, 80] for range
defaultValue
objectDefault array of thumb values (number[]) for uncontrolled usage
onValueChange
functionCallback on value change: (value: number[]) => void
min
number0Minimum value
max
number100Maximum value
step
number1Step interval between valid values
disabled
booleanfalseDisable the slider
orientation
"horizontal" | "vertical"horizontalSlider direction

AI Guidance

When to use

Use for continuous numeric inputs with a known range: volume, brightness, price range filter, opacity. Pair value with a visible number display when the exact value matters.

When not to use

Don't use when the user needs to enter an exact number (use Input type=number). Don't use for discrete choices (use Select or RadioGroup).

Common mistakes

  • Using Slider for exact values without showing the number
  • Missing min/max bounds
  • Using step=1 for fractional values (set step=0.01)
  • Not providing aria-label when there's no visible label

Accessibility

Arrow keys step by step, Home/End jump to min/max, PageUp/PageDown step larger. Radix handles aria-valuemin/max/now. Add aria-label if no visible label.

Related components

Token budget: 450