Slider

An input where the user selects a value from within a given range.

Features

  • Can be controlled or uncontrolled.
  • Supports multiple thumbs.
  • Supports a minimum value between thumbs.
  • Supports touch or click on track to update value.
  • Supports Right to Left direction.
  • Full keyboard navigation.

Install the component from your command line.

Import the components and piece the parts together.

Create your styled slider component from the primitive parts.

Contains all the parts of a slider.

PropTypeDefaultRequired
asenumspan
defaultValuenumber[]
valuenumber[]
namestring
disabledbooleanfalse
orientationenum"horizontal"
direnum"ltr"
minnumber0
maxnumber100
stepnumber1
onValueChangefunction
minStepsBetweenThumbsnumber0

The track that contains the Slider.Range.

PropTypeDefaultRequired
asenumspan

The range part. Must live inside Slider.Track.

PropTypeDefaultRequired
asenumspan

A draggable thumb. You can render multiple thumbs.

PropTypeDefaultRequired
asenumspan

Use the orientation prop to create a vertical slider.

Add multiple thumbs and values to create a range slider.

Use the step prop to increase the stepping interval.

Use minStepsBetweenThumbs to avoid thumbs with equal values.

Adheres to the Slider WAI-ARIA design pattern.

KeyDescription
ArrowRightIncrements/decrements by the step value depending on orientation.
ArrowLeftIncrements/decrements by the step value depending on orientation.
ArrowUpIncreases the value by the step amount.
ArrowDownDecreases the value by the step amount.
PageUpIncreases the value by a larger step.
PageDownDecreases the value by a larger step.
Shift + ArrowUpIncreases the value by a larger step.
Shift + ArrowDownDecreases the value by a larger step.
HomeSets the value to its minimum.
EndSets the value to its maximum.