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";

Examples

Overview

Adding a tooltip

Marks

Range

Multiple thumbs

Vertical

Disabled

API

PropTypeDefaultDescription
valuenumber | number[]—Required. Current value; an array when range is set. Bind with v-model:value
minnumber—Required. Minimum value
maxnumber—Required. Maximum value
stepnumber—Required. Step increment
rangebooleanfalseEnable multi-thumb range mode
orientation"horizontal" | "vertical""horizontal"Layout direction of the slider
reset-valuenumber—Value for the reset option (single mode only)
reset-tooltipstring"Reset to default"Tooltip and accessible name of the reset button (single mode only)
unitstring—Unit displayed after the value (e.g. ms, px)
prefix-unitstring—Unit displayed before the value (e.g. $)
labelstring—Label text. Also names the slider thumbs for assistive technology
label slotVNode[]—Rich label content (e.g. a tooltip); takes precedence over the label prop
aria-labelstring—Accessible name when there is no visible label. Range thumbs add Minimum / Maximum (or Value n of m)
aria-labelledbystring—Id of an element that names the slider; takes precedence over label
marksArray<{ value: number, label: string }>—Marks below the track (horizontal only)
track-colorstring—Color of the slider track
range-colorstring—Color of the filled part of the track
min-steps-between-thumbsnumber—Minimum steps between thumbs (range mode only)
disabledbooleanfalseDisable the slider
classstring—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

Slider reads these component tokens. Override them at any scope to restyle it:

  • --slider-range-color: range color (default light-dark(var(--gray-450), var(--gray-600)))
  • --slider-track-color: track color (default light-dark(var(--gray-150), var(--gray-400)))