Skip to content

Slider

Range input for selecting numeric values visually. Supports single value, dual-thumb range, steps, and vertical orientation.

When to use

  • Price/budget range filters
  • Volume, opacity, or brightness controls
  • Any numeric input where a visual scale aids selection

When not to use

  • Precise values where exact input matters — use Input with type="number"
  • Binary choices — use Toggle
  • Selecting from discrete options — use Select or Radio

Default

Range (dual thumb)

Disabled


CSS classes

ClassDescription
.sliderRoot container
.slider__headerLabel + value row
.slider__labelLabel text
.slider__valueValue display — tabular-nums
.slider__controlInteractive track area (touch target)
.slider__trackFull-width rail
.slider__rangeFilled portion (primary color)
.slider__thumbDraggable handle — circle, shadow, focus ring
.slider--verticalVertical orientation
.slider--disabledDisabled state
.slider--rangeDual-thumb range mode

Data attributes (vanilla JS)

AttributeDescription
data-minMinimum value (default: 0)
data-maxMaximum value (default: 100)
data-stepStep increment (default: 1)

Accessibility

  • Thumb has role="slider" with aria-valuemin, aria-valuemax, aria-valuenow
  • aria-orientation set for vertical sliders
  • Keyboard: ArrowLeft/Right/Up/Down (step), Home/End (min/max), PageUp/PageDown (10× step)
  • Range mode: each thumb has scoped aria-valuemin/max to prevent crossing
  • touch-action: none prevents scroll interference during drag
  • prefers-reduced-motion disables thumb animations

References