Overview
Slider provides an input for selecting numeric values from a continuous or discrete range. It supports single or multiple thumbs for range selection.Features
- Can be controlled or uncontrolled
- Supports multiple thumbs
- Supports a minimum value between thumbs
- Supports horizontal/vertical orientation
- Supports custom step intervals
- Full keyboard navigation
- Works inside forms
- Accessible by default with proper ARIA attributes
Installation
Anatomy
API Reference
Root
Contains all the slider component parts.The controlled value of the slider. Must be an array of numbers.
The value when initially rendered (uncontrolled). Must be an array of numbers.
Event handler called when the value changes.
Event handler called when the value changes at the end of an interaction. Useful when you only need to capture a final value e.g. to update a backend service.
The name of the slider. Submitted with its owning form as part of a name/value pair.
When true, prevents the user from interacting with the slider.
The orientation of the slider.
The reading direction of the slider. If omitted, inherits from the parent.
Whether the slider is visually inverted.
The minimum value for the slider.
The maximum value for the slider.
The stepping interval.
The minimum permitted steps between multiple thumbs.
Change the default rendered element for the one passed as a child.
Track
The track that contains the range.Change the default rendered element for the one passed as a child.
Range
The range part. Must live inside Track.Change the default rendered element for the one passed as a child.
Thumb
A draggable thumb. You can render multiple thumbs.Change the default rendered element for the one passed as a child.
Example
Accessibility
Adheres to the Slider WAI-ARIA design pattern.
Keyboard Interactions
- ArrowRight - Increments the value by the step amount.
- ArrowLeft - Decrements the value by the step amount.
- ArrowUp - Increases the value by the step amount (vertical orientation).
- ArrowDown - Decreases the value by the step amount (vertical orientation).
- PageUp - Increases the value by 10% of the total range.
- PageDown - Decreases the value by 10% of the total range.
- Home - Sets the value to the minimum.
- End - Sets the value to the maximum.
Data Attributes
Root[data-disabled]- Present when disabled[data-orientation]- “horizontal” or “vertical”
[data-disabled]- Present when disabled[data-orientation]- “horizontal” or “vertical”
[data-disabled]- Present when disabled[data-orientation]- “horizontal” or “vertical”
[data-disabled]- Present when disabled[data-orientation]- “horizontal” or “vertical”