Slider
Headless slider for single-value and range inputs with pointer drag, keyboard navigation, and step snapping.
Usage
The Slider supports single-value and range modes. Add one Slider.Thumb for a single value, or two for a range.
Value: 50
Range: 25 – 75
Anatomy
<script setup lang="ts">
import { Slider } from '@vuetify/v0'
</script>
<template>
<Slider.Root>
<Slider.Track>
<Slider.Range />
</Slider.Track>
<Slider.Thumb />
<Slider.HiddenInput />
</Slider.Root>
</template>Architecture
The Root component composes createSlider for pointer/keyboard interaction and createModel for value storage. Each Thumb registers via a ticket and receives its position as a percentage.
The Root creates a slider instance and provides it via context. Track listens for pointer events to update the nearest thumb. Each Thumb registers itself and manages drag/keyboard interaction for its value. Range renders the filled region between thumbs (or from min to a single thumb).
Examples
Recipes
Form Integration
Set name on Root to auto-render hidden inputs for form submission — one per thumb:
<template>
<Slider.Root name="price" :min="0" :max="1000">
<Slider.Track>
<Slider.Range />
</Slider.Track>
<Slider.Thumb />
</Slider.Root>
</template>Drag Events
Root emits start and end for pointer drag lifecycle:
<template>
<Slider.Root
v-model="value"
@start="onStart"
@end="onEnd"
>
<Slider.Track>
<Slider.Range />
</Slider.Track>
<Slider.Thumb />
</Slider.Root>
</template>Data Attributes
Style interactive states without slot props:
<template>
<Slider.Thumb class="data-[state=dragging]:scale-125 transition-transform" />
</template>| Attribute | Values | Components |
|---|---|---|
data-state | dragging, idle | Thumb |
data-disabled | true | Root, Track, Range, Thumb |
data-readonly | true | Root, Track, Range, Thumb |
data-orientation | horizontal, vertical | Root, Track, Range |
Accessibility
Each Slider.Thumb manages its own ARIA attributes automatically.
ARIA Attributes
| Attribute | Value | Notes |
|---|---|---|
role | slider | Applied to each Thumb |
aria-valuenow | Current value | Updates on drag/keyboard |
aria-valuemin | Min value | From Root’s min prop |
aria-valuemax | Max value | From Root’s max prop |
aria-valuetext | Custom text | Optional, via Thumb prop |
aria-orientation | horizontal / vertical | Reflects Root orientation |
aria-disabled | true | When slider is disabled |
aria-readonly | true | When slider is readonly |
tabindex | 0 / removed | Removed when disabled |
Keyboard Navigation
| Key | Action |
|---|---|
ArrowRight / ArrowUp | Increment by one step |
ArrowLeft / ArrowDown | Decrement by one step |
Shift+Arrow | Increment/decrement by 10 steps |
PageUp | Increment by 10 steps |
PageDown | Decrement by 10 steps |
Home | Set to minimum |
End | Set to maximum |
FAQ
Render two Slider.Thumb elements inside Slider.Root for a range; a single Slider.Thumb gives a single value. Slider.Range fills the region between the thumbs (or from min to a lone thumb).
Set name on Slider.Root to auto-render hidden inputs — one per thumb — so both single values and ranges post with the form.
Slider.Root emits start and end events for the pointer-drag lifecycle. Bind @start and @end for things like committing a value only once the drag completes.
Set orientation="vertical" on Slider.Root. It reflects through aria-orientation and the data-orientation attribute, and the arrow keys adapt so Up/Down increment and decrement.
Yes. Arrow keys move by one step; Shift+Arrow, PageUp, and PageDown move by 10 steps; Home and End jump to the minimum and maximum.