Slider
Pick a number, or a range, by dragging or with the keyboard.
MarkdownExamples
Basic
Range
Bind a [start, end] array for two thumbs. commit fires when a drag ends, for anything expensive.
$200 – $800
Vertical
API
| Prop | Type | Default |
|---|---|---|
minLowest value. | number | 0 |
maxHighest value. | number | 100 |
stepArrow-key increment. Values snap to it. | number | 1 |
largeStepPageUp/PageDown increment. Defaults to ten steps. | number | — |
orientationLayout hook, exposed as | "horizontal" | "vertical" | "horizontal" |
disabledDisables the slider. | boolean | false |
labelVisible label, which names the thumb(s). | string | — |
thumbLabelsAccessible names for the two thumbs of a range. Default to | [string, string] | — |
formatValueText for | ((value: number) => string) | — |
nameForm field name; renders a hidden input per value. | string | — |
modelValueA number, or | T | — |
| Event | Payload |
|---|---|
commitA drag ended, or a key changed the value. Use it for expensive work. | [value: T] |
update:modelValue
| [value: T | undefined] |
| Slot | Props |
|---|---|
thumbThumb content, e.g. a value bubble. | { value: number; index: number; } |
Styling
The range and thumbs are placed with --ui-slider-start, --ui-slider-end and --ui-slider-value (percentages).
- Parts
sliderslider-labelslider-controlslider-trackslider-rangeslider-thumb- States
data-orientationdata-slider-disableddata-slider-thumb
Keyboard
| Keys | Action |
|---|---|
← / →, ↓ / ↑ | One step |
Page Up / Page Down | largeStep (ten steps by default) |
Home / End | Minimum / maximum |
Accessibility
- Each thumb is named by
label; a range's thumbs also getthumb-labels(“Minimum”, “Maximum”). - Use
format-valueso screen readers hear units, e.g. “60%”. - In right-to-left layouts,
←/→follow the visual direction.