formsslider
Slider
Range slider component with single or multiple thumbs and step markers.
Import#
Slot Structure#
Track with a fill range and one or more draggable thumb handles.
Examples#
Controlled Single#
Input phase updates with onValueChange and commit phase updates with onChange.
Variants#
Default and bold variants with visual step dividers.
There will be no effective if
dividerset to true butstepdoes not set.
Sizes#
Track and thumb sizing from xs to xl.
Disabled#
Disabled sliders keep values visible while preventing interaction.
Orientations and Invert#
Horizontal default layout and vertical layout with fixed container height.
Range Slider#
Two thumbs with controlled array value, optional minimum gap, and configurable thumb crossing.
Form Integration#
Submit to validate required minimum value through Form + FormField.
API Reference#
Attributes#
Slot
root6 attributesSlider container that owns track, range, thumbs, and labels.
Data Attributes
| Data Attribute | Description |
|---|---|
| data-disabled | Present when the component or item is disabled. |
| data-invalid | Present when the field has a validation error. |
| data-orientation | Stores the rendered orientation. |
| data-readonly | Present when the field is read-only. |
| data-required | Present when the field is required. |
ARIA Attributes
| ARIA Attribute | Description |
|---|---|
| role | Defines the semantic role exposed to assistive technology. |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| allowThumbCrossing | boolean | undefined | true | Whether dragging can continue across another thumb when there is no minimum gap. |
| class | ClassValue | — | Class applied to the component root or trigger element. |
| classes | SliderT.Classes | undefined | — | — |
| defaultValue | TValue | undefined | — | The default value of the input (uncontrolled). |
| disabled | boolean | undefined | false | Whether the input is disabled. |
| divider | boolean | undefined | false | Whether to show visual step dividers on the track, only applicable when `step` is defined and greater than 0. |
| id | string | undefined | — | The ID of the input element. |
| inverted | boolean | undefined | — | — |
| max | number | undefined | 100 | Maximum value of the slider. |
| min | number | undefined | 0 | Minimum value of the slider. |
| minStepsBetweenThumbs | number | undefined | 0 | Minimum steps required between thumbs in a multi-thumb slider. |
| name | string | undefined | — | The name of the input element, used for form submission. |
| onChange | ((value: TValue) => void) | undefined | — | Callback when the slider selection change is committed. |
| onValueChange | ((value: TValue) => void) | undefined | — | Callback when the slider selection changes during interaction. |
| orientation | "horizontal" | "vertical" | undefined | — | — |
| readOnly | boolean | undefined | false | Whether the input is read-only. |
| ref | JSX.HTMLElementTags["div"] extends { ref?: infer Ref; } ? Ref : never | undefined | — | — |
| required | boolean | undefined | false | Whether the input is required. |
| size | "xs" | "sm" | "md" | "lg" | "xl" | undefined | — | — |
| step | number | undefined | — | Step increment between values.
When omitted, pointer movement is continuous. |
| style | JSX.CSSProperties | undefined | — | — |
| styles | SliderT.Styles | undefined | — | — |
| value | TValue | undefined | — | The current value of the input (controlled). |
| variant | "default" | "bold" | undefined | — | — |