Slider

VdSlider styles a native <input type="range"> with a themed track, fill and thumb. It renders from pure CSS and binds with v-model (numbers) — with optional label and live value read-out.

Basic With Value
60
40
<div class="vd-slider-field">
  <label for="volume" class="vd-form-label">Volume</label>
  <div class="vd-slider-row">
    <input id="volume" type="range" class="vd-slider" min="0" max="100" value="60" />
    <span class="vd-slider-value">60</span>
  </div>
</div>
Custom Range & Step
250
2
<input
  type="range"
  class="vd-slider"
  min="0"
  max="500"
  step="10"
  value="250" />
Disabled
<input type="range" class="vd-slider" value="50" disabled />
Decimal Steps

Current zoom:

2
<input
  type="range"
  class="vd-slider"
  min="1"
  max="5"
  step="0.5"
  value="2" />
API Reference

Usage

<script setup lang="ts">
import { VdSlider } from "@vanduo-oss/vd3";
const volume = ref(60);
</script>

<template>
  <VdSlider v-model="volume" label="Volume" :min="0" :max="100" show-value />
</template>

CSS Classes

ClassDescription
.vd-sliderStyles a native <input type="range"> — track, fill and thumb
.vd-slider-fieldOptional wrapper grouping a label above the slider row
.vd-slider-rowFlex row that aligns the slider with its value read-out
.vd-slider-valueText element showing the current numeric value

Component API

Prop / eventDescription
v-model (modelValue)Two-way bound value (number).
:min / :maxRange bounds (defaults 0 / 100).
:stepIncrement between stops (default 1; accepts decimals).
:labelOptional label rendered above the slider.
:show-valueRenders the live numeric value beside the track.
:disabledGreys out and blocks interaction when true.
:name / :idForwarded to the underlying input for forms / labels.
@update:modelValueFired with the new number as the user drags.

Events

EventDescription
input Native event fired continuously as the thumb moves. In Vue, prefer @update:modelValue (via v-model), which emits a number.
Accessibility
  • Built on a native range input, so it's fully keyboard operable: / step by step; Home / End jump to min / max.
  • The component mirrors min/max/value into aria-valuemin / aria-valuemax / aria-valuenow.
  • Pass a label (or wire id) so screen readers announce what the slider controls.