Skip to content

FormSlider

Range / value slider built on Reka UI's Slider primitive. One component covers both modes — the shape of v-model decides:

v-model shapeModeThumbs
numberSingle value1
number[] (length 2)Range2
number[] (length N)Multi-thumbN
bash
npm install @vuecs/forms

Basic usage

vue
<script setup lang="ts">
import { VCFormSlider } from '@vuecs/forms';
import { ref } from 'vue';

const volume = ref<number>(40);
const range = ref<number[]>([20, 80]);
</script>

<template>
    <VCFormSlider v-model="volume" :min="0" :max="100" />
    <VCFormSlider v-model="range" :min="0" :max="100" />
</template>
css
@import "tailwindcss";
@import "@vuecs/design";

@import "@vuecs/forms";

@custom-variant dark (&:where(.dark, .dark *));

Props

PropTypeDefaultDescription
modelValuenumber | number[] | nullundefinedBound value(s). Array → multi-thumb.
minnumber0Lower bound
maxnumber100Upper bound
stepnumber1Increment per arrow-key press
orientation'horizontal' | 'vertical''horizontal'Layout + drag axis
invertedbooleanfalseVisually invert the track direction
disabledbooleanfalseDisable interaction
requiredbooleanfalseNative form-required attribute
namestringundefinedForm-submission name
minStepsBetweenThumbsnumber0Minimum step gap between adjacent thumbs (multi only)
themeClassPartial<FormSliderThemeClasses>undefinedPer-instance theme override
themeVariantRecord<string, string | boolean>undefinedPer-instance variant values

Events

EventPayloadDescription
update:modelValuenumber | number[]Emitted as the user drags; mirrors the modelValue shape
valueCommitnumber | number[]Emitted when the user releases the thumb (commit point)

Migration from <VCFormRangeMultiSlider>

The hand-rolled VCFormRangeMultiSlider was removed in 3.0 — <VCFormSlider> replaces it on top of Reka's accessible Slider primitive. The old @change event payload ({ min, max }) is gone; bind to v-model (or listen for valueCommit) to read the array.

diff
- <VCFormRangeMultiSlider :min="0" :max="100" @change="handle" />
+ <VCFormSlider v-model="range" :min="0" :max="100" />

Released under the Apache 2.0 License.