Slider
A single-thumb and multi-thumb range slider with pointer drag, keyboard stepping, and form integration.
A slider input for selecting a single numeric value or a range of values via pointer/touch dragging, keyboard stepping, and form fields.
Preview
Section titled “Preview”Single thumb
Section titled “Single thumb”Range and multiple values
Section titled “Range and multiple values”Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import the scalar Slider parts or the six sliderValues* multi-value entries from @proto.ui/prototypes-base/slider.
Single-thumb composition
Section titled “Single-thumb composition”Compose Root, Label, Track, Indicator, Thumb, FieldThumb, and Value:
- Dragging and keyboard stepping:
Rootmanages value, bounds, and orientation.Trackhandles pointer and touch dragging;Thumbsupports arrow keys,Shift×10 steps,PageUp/PageDown, andHome/End, reversing horizontal arrows inrtlmode. Values clamp to[min, max]and snap fromminbystep. - Controlled mode and commits: Pass
valuefor controlled mode (interactions emitvalueChangewithout overwriting external state).valueCommitfires when a drag or keyboard edit completes; canceling a drag restores the uncontrolled start value. - Form integration: Use
FieldThumbinstead ofThumbinsideField/FormFieldto bridgeFieldLabel, numeric validation, serialization, and reset. UseLabelwith standaloneThumb.
Range and multiple values (sliderValues*)
Section titled “Range and multiple values (sliderValues*)”Import the six sliderValues* entries from @proto.ui/prototypes-base/slider, pass an array such as defaultValue={[20, 80]} on Values Root, and place one indexed Thumb per value inside Values Track:
- Track interaction and collisions: Clicking the track seeks the nearest editable thumb, and off-center thumb grabs preserve the initial pointer offset.
thumbCollisionBehavioraccepts'push','swap', or'none'('swap'transfers active focus while keeping capture on the track). - Form integration:
Values Rootworks directly insideField/FormField, reporting anumber[]value, initial baseline, and group focus (FieldLabelfocuses the first editable thumb). Resetting cancels any active drag and requests the initial baseline.
Root (Single thumb)
Section titled “Root (Single thumb)”| Prop | Type | Default |
|---|---|---|
defaultValue | number | 0 |
min | number | 0 |
max | number | 100 |
step | number | 1 |
disabled | boolean | false |
readOnly | boolean | false |
orientation | 'horizontal' 'vertical' | horizontal |
direction | 'ltr' 'rtl' | ltr |
ariaLabel | string | '' |
valueText | string | '' |
Pass value to control the slider value. Other scalar parts take no additional props. The multi-value Values Root accepts number[] for value / defaultValue and thumbCollisionBehavior ('push' | 'swap' | 'none').