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.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | span | |
defaultValue | number[] | ||
value | number[] | ||
name | string | ||
disabled | boolean | false | |
orientation | enum | "horizontal" | |
dir | enum | "ltr" | |
min | number | 0 | |
max | number | 100 | |
step | number | 1 | |
onValueChange | function | ||
minStepsBetweenThumbs | number | 0 |
The track that contains the Slider.Range
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | span |
The range part. Must live inside Slider.Track
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | span |
A draggable thumb. You can render multiple thumbs.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | span |
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.
Key | Description |
---|---|
ArrowRight | Increments/decrements by the step value depending on orientation . |
ArrowLeft | Increments/decrements by the step value depending on orientation . |
ArrowUp | Increases the value by the step amount. |
ArrowDown | Decreases the value by the step amount. |
PageUp | Increases the value by a larger step . |
PageDown | Decreases the value by a larger step . |
Shift + ArrowUp | Increases the value by a larger step . |
Shift + ArrowDown | Decreases the value by a larger step . |
Home | Sets the value to its minimum. |
End | Sets the value to its maximum. |