Slider
Drag the slider within a fixed range.
TIP
This component requires the <client-only></client-only>
wrap when used in SSR (eg: Nuxt) and SSG (eg: VitePress).
Basic usage
The current value is displayed when the slider is being dragged.
Discrete values
The options can be discrete.
Slider with input box
Set value via a input box.
Sizes
Placement
You can custom tooltip placement.
Range selection
Selecting a range of values is supported.
Vertical mode
Show marks
API
Attributes
Name | Description | Type | Default |
---|---|---|---|
model-value / v-model | binding value | number / object | 0 |
min | minimum value | number | 0 |
max | maximum value | number | 100 |
disabled | whether Slider is disabled | boolean | false |
step | step size | number | 1 |
show-input | whether to display an input box, works when range is false | boolean | false |
show-input-controls | whether to display control buttons when show-input is true | boolean | true |
size | size of the slider wrapper, will not work in vertical mode | enum | default |
input-size | size of the input box, when set size , the default is the value of size | enum | default |
show-stops | whether to display breakpoints | boolean | false |
show-tooltip | whether to display tooltip value | boolean | true |
format-tooltip | format to display tooltip value | Function | — |
range | whether to select a range | boolean | false |
vertical | vertical mode | boolean | false |
height | slider height, required in vertical mode | string | — |
label a11y deprecated | native aria-label attribute | string | — |
aria-label a11y 2.7.2 | native aria-label attribute | string | — |
range-start-label | when range is true, screen reader label for the start of the range | string | — |
range-end-label | when range is true, screen reader label for the end of the range | string | — |
format-value-text | format to display the aria-valuenow attribute for screen readers | Function | — |
debounce | debounce delay when typing, in milliseconds, works when show-input is true | number | 300 |
tooltip-class | custom class name for the tooltip | string | — |
placement | position of Tooltip | enum | top |
marks | marks, type of key must be number and must in closed interval [min, max] , each mark can custom style | object | — |
validate-event | whether to trigger form validation | boolean | true |
Events
Name | Description | Type |
---|---|---|
change | triggers when the value changes (if the mouse is being dragged, this event only fires when the mouse is released) | Function |
input | triggers when the data changes (It'll be emitted in real time during sliding) | Function |
Type Declarations
Show declarations
type SliderMarks = Record<number, string | { style: CSSProperties; label: any }>
type Arrayable<T> = T | T[]