Form
Slider
Pick a value, or a range, by dragging along a track or with the keyboard.
WAI-ARIA tested
Import
main.ts
import { Slider } from '@vitral/vue';Basic
Range
v-model is [start, end]. One name covers both thumbs, which are told apart as minimum and maximum.
Vertical
The minimum is at the bottom; Up and Right both increase.
Bass 30 · Treble 70 · 21 °C
Disabled
API
Read from packages/vue/src/components/Slider/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| min | number | Defaults to 0. |
| max | number | Defaults to 100. |
| step | number | Distance between neighbouring values; defaults to 1. 0 lets the thumb stop anywhere. |
| range | boolean | Two thumbs: v-model is `[start, end]`, and the thumbs never cross. |
| orientation | 'horizontal' | 'vertical' | A vertical slider has its minimum at the bottom. |
| disabled | boolean | — |
| formatValue | (value: number) => string | Text a screen reader announces for a value (`aria-valuetext`): "20 °C" rather than "20". |
| ariaLabel | string | string[] | The thumb's accessible name. For a range, one string names both thumbs together with the locale's "minimum"/"maximum"; an array names each. |
| ariaLabelledby | string | string[] | Id(s) of the element(s) naming the thumbs; an array names each thumb of a range. |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| change | value: SliderValue | The value was committed: after a key press, or when a drag ends having moved it. |
| slideend | event: SliderSlideEndEvent | A pointer interaction ended. |