Slider
Allows users to select a value from a continuous range by sliding a handle.
Structure
Examples
Multiple Thumbs and Ticks
If the value
prop has more than one value, the slider will render multiple thumbs. You can also use the ticks
slot prop to render ticks at specific intervals.
Vertical Orientation
You can use the orientation
prop to change the orientation of the slider, which defaults to "horizontal"
.
RTL Support
You can use the dir
prop to change the reading direction of the slider, which defaults to "ltr"
.
API Reference
The root slider component which contains the remaining slider components.
Property | Type | Description |
---|---|---|
value | number[] | The current value of the slider. Default:
[] |
onValueChange | function | A callback function called when the value state of the slider changes. Default:
undefined |
disabled | boolean | Whether or not the switch is disabled. Default:
false |
max | number | The maximum value of the slider. Default:
100 |
min | number | The minimum value of the slider. Default:
0 |
orientation | enum | The orientation of the slider. Default:
"horizontal" |
step | number | The step value of the slider. Default:
1 |
dir | enum | The reading direction of the slider. If set to 'rtl', the slider will be reversed for both Default:
"ltr" |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
el | HTMLSpanElement | The underlying DOM element being rendered. You can bind to this to programatically interact with the element. Default:
undefined |
Slot Property | Type | Description |
---|---|---|
ticks | Tick[] | The tick builders to pass to the individual |
thumbs | Thumb[] | The thumb builders to pass to the individual |
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-orientation | enum | The orientation of the slider. |
data-slider-root | —— | Present on the root element. |
The range of the slider.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
el | HTMLSpanElement | The underlying DOM element being rendered. You can bind to this to programatically interact with the element. Default:
undefined |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-slider-range | —— | Present on the range elements. |
A thumb on the slider.
Property | Type | Description |
---|---|---|
thumb | Thumb | An individual thumb builder from the Default:
undefined |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
el | HTMLSpanElement | The underlying DOM element being rendered. You can bind to this to programatically interact with the element. Default:
undefined |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-slider-thumb | —— | Present on the thumb elements. |
A tick mark on the slider.
Property | Type | Description |
---|---|---|
tick | Tick | An individual tick builder from the Default:
undefined |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
el | HTMLSpanElement | The underlying DOM element being rendered. You can bind to this to programatically interact with the element. Default:
undefined |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-bounded | —— | Present when the tick is bounded. |
data-slider-tick | —— | Present on the tick elements. |