Slider
An input where the user selects a value from within a given range.
Preview
Installation
npx sigma-ui@latest add sliderUsage
<script setup lang="ts">
import { ref } from 'vue';
import { Slider } from '@/components/ui/slider';
const modelValue = ref([33]);
</script>
<template>
<Slider
v-model="modelValue"
:max="100"
:step="1"
/>
</template>v-modelis anumber[]. The slider renders one thumb per value, so pass two values (for example[25, 75]) to select a range.- Use
min,max, andstepto set the range and the increment.
Examples
Form
API Reference
Slider
Props
| Prop | Type | Default |
|---|---|---|
defaultValueThe value of the slider when initially rendered. Use when you do not need to control the state of the slider. | number[] | - |
modelValueThe controlled value of the slider. Can be bind as | number[] | null | - |
disabledWhen | boolean | - |
orientationThe orientation of the slider. | DataOrientation | - |
dirThe reading direction of the combobox when applicable. <br> If omitted, inherits globally from | Direction | - |
invertedWhether the slider is visually inverted. | boolean | - |
minThe minimum value for the range. | number | - |
maxThe maximum value for the range. | number | - |
stepThe stepping interval. | number | - |
minStepsBetweenThumbsThe minimum permitted steps between multiple thumbs. | number | - |
thumbAlignmentThe alignment of the slider thumb.
| ThumbAlignment | 'contain' |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
nameThe name of the field. Submitted with its owning form as part of a name/value pair. | string | - |
requiredWhen | boolean | - |
Events
| Event | Payload |
|---|---|
update:modelValueEvent handler called when the slider value changes | [payload: number[]] |
valueCommitEvent handler called when the value changes at the end of an interaction. Useful when you only need to capture a final value e.g. to update a backend service. | [payload: number[]] |
Accessibility
Adheres to the Slider WAI-ARIA design pattern. Reka UI handles the roles, values, and keyboard support.
| Key | Description |
|---|---|
| Tab | Moves focus to the next thumb or focusable element. |
| ArrowRight | Increments the value by step. |
| ArrowLeft | Decrements the value by step. |
| ArrowUp | Increments the value by step. |
| ArrowDown | Decrements the value by step. |
| PageUp | Increments the value by a larger step. |
| PageDown | Decrements the value by a larger step. |
| Shift + ArrowUp | Increments the value by a larger step. |
| Shift + ArrowDown | Decrements the value by a larger step. |
| Home | Sets the value to its minimum. |
| End | Sets the value to its maximum. |