Slider
Choose a number or range by moving one or more thumbs.
Use Slider when a numeric value or range is best chosen spatially. Pair it with a labeled numeric field when users need precise text entry.
Basic usage#
Playground#
Anatomy#
Usage#
Single values and ranges#
Use a scalar value for a single thumb and an ordered pair for a range. Pair value with onValueChange for controlled state; onValueChange also reports immediate updates during drag when the slider owns its value.
Step and markers#
Set step to snap pointer drag and keyboard navigation to fixed increments. Enable marker to render visual tick marks at each step interval across the track rail.
Keyboard and forms#
Add name for native form submission, or place the slider inside form.Field from
createForm for schema binding. Use standalone Field when
you only need a label and messages.
Keyboard interaction#
When step is omitted, keyboard stepping defaults to 1% of the configured range. Page-sized movement is approximately 10% of the range and is snapped to step when one is defined.
| Key | Description |
|---|---|
| → / ↑ | Moves in the increasing direction by one keyboard step. |
| ← / ↓ | Moves in the decreasing direction by one keyboard step. |
| Shift + Arrow | Moves by the page-sized increment. |
| ⇞ / ⇟ | Moves by the page-sized increment. |
| ↖ | Moves the focused thumb to its minimum permitted value. |
| ↘ | Moves the focused thumb to its maximum permitted value. |
Examples#
Controlled value#
Range#
Form integration#
Blur slider#
Attributes#
data-disabledSlot: slider, slider-thumbDescription: Present when the component, slot, or item is disabled.data-draggingSlot: slider, slider-thumbDescription: Present while the related thumb or handle is being dragged.data-invalidSlot: slider, slider-thumbDescription: Present when the field or form has a validation error.data-invertedSlot: slider, slider-range, slider-thumbDescription: Present when the component direction or range is inverted.data-multipleSlot: slider, slider-rangeDescription: Present when the control contains or selects multiple values.data-readonlySlot: slider, slider-thumbDescription: Present when the field is in read-only mode.data-requiredSlot: slider, slider-thumbDescription: Present when the field input is required.Props#
Props for the Slider component. Renders a <div> element by default.