Slider
A number picked by dragging, when the feel of the value matters more than its exact digits: a volume, a radius, an opacity. For an exact number use an input.
Radius · 14px
vue
<script setup lang="ts">
import { ref } from 'vue'
const radius = ref(14)
</script>
<template>
<span>Radius · {{ radius }}px</span>
<OSlider v-model="radius" :max="24" aria-label="Radius" />
</template>The arrow keys move the thumb by one step, Page Up and Page Down by a larger one, Home and End go to the ends. The slider does not print its value: show it next to the label, as above.
Give it an aria-label: it goes to the thumb, which is the control a screen reader meets.
Step
step is the distance between two values the thumb can stop at.
Glass darkness · 30%
vue
<OSlider v-model="glass" :min="10" :max="70" :step="5" aria-label="Glass darkness" />Disabled
vue
<OSlider v-model="volume" disabled aria-label="Volume" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
v-model | number | 0 | The value |
min | number | 0 | |
max | number | 100 | |
step | number | 1 | Distance between two values |
disabled | boolean | false |
class and style go to the slider; other attributes (aria-label, name) go to the thumb.
Built on Reka UI Slider.