Slider
Slider for fine-tuning numeric values with single or range thumbs, marks, an editable value input, and vertical orientation.
import { Slider } from "@plexui/vue/components/Slider";On Phone, each slider stands in a cell of a grouped list, as in iOS Settings: the group's title names the slider, the slider fills the cell, a short value ends it, and a longer value goes under the track. For a slider among other settings, see Settings with a slider.
Examples
Overview
Example field
Adding a tooltip
Marks
Passing grade
Range
Price range
Multiple thumbs
Breakpoints
Vertical
API
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | number[] | — | Required. Current value; an array when range is set. Bind with v-model:value |
min | number | — | Required. Minimum value |
max | number | — | Required. Maximum value |
step | number | — | Required. Step increment |
range | boolean | false | Enable multi-thumb range mode |
orientation | "horizontal" | "vertical" | "horizontal" | Layout direction of the slider |
reset-value | number | — | Value for the reset option (single mode only) |
reset-tooltip | string | "Reset to default" | Tooltip and accessible name of the reset button (single mode only) |
unit | string | — | Unit displayed after the value (e.g. ms, px) |
prefix-unit | string | — | Unit displayed before the value (e.g. $) |
label | string | — | Label text. Also names the slider thumbs for assistive technology |
label slot | VNode[] | — | Rich label content (e.g. a tooltip); takes precedence over the label prop |
aria-label | string | — | Accessible name when there is no visible label. Range thumbs add Minimum / Maximum (or Value n of m) |
aria-labelledby | string | — | Id of an element that names the slider; takes precedence over label |
marks | Array<{ value: number, label: string }> | — | Marks below the track (horizontal only) |
track-color | string | — | Color of the slider track |
range-color | string | — | Color of the filled part of the track |
min-steps-between-thumbs | number | — | Minimum steps between thumbs (range mode only) |
disabled | boolean | false | Disable the slider |
class | string | — | Extra classes on the wrapper element |
@update:value | (value: number | number[]) => void | — | Emitted when the value changes; an array when range is set; powers v-model:value |
@change | (value: number | number[]) => void | — | Emitted with update:value, named after the React onChange prop |
@focus | (event: FocusEvent) => void | — | Emitted when the value input or a thumb gains focus |
@blur | (event: FocusEvent) => void | — | Emitted when the value input or a thumb loses focus |
Typing in the value input reports the parsed value after 250ms; Enter, Escape or leaving the input commits it right away, and Home, End and the arrow keys (Shift for ten steps) change it at once. The input accepts a minus sign when min is below zero. Inside a <form>, a hidden input per thumb fires an input event when its value changes.
Styling
On a phone the slider follows the iOS 27 kit: the thumb of a horizontal slider turns into a clear lens of glass over the track while it is pressed (of a range, the thumb nearest the press), and a disabled slider shows at half opacity. On a desktop a disabled slider follows the macOS 27 kit: the accent leaves it, so its fill takes the track's color and both lighten, the fill a shade darker where it lies over the track, and the thumb keeps its face.
Slider reads these component tokens. Override them at any scope to restyle it:
--slider-range-color: range color (defaultlight-dark(var(--gray-450), var(--gray-600)))--slider-track-color: track color (defaultlight-dark(var(--gray-150), var(--gray-400)))