Volume level
Choose a value in a familiar bounded 0–100 range.
Components / Forms
A styled native range input with optional visible value formatting.
Last changed in version 0.14.2: Improve keyboard navigation, action feedback, and selected colors across Vue components.
bunx --bun @getweini/cli@latest add sliderImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
<script setup lang="ts">
import { ref } from 'vue'
import Slider from './components/ui/slider/Slider.vue'
const volume = ref(40)
</script>
<template>
<Slider v-model="volume" :min="0" :max="100" show-value aria-label="Volume" />
</template>Native range keyboard, focus, form, and accessibility behavior is preserved. Supply an accessible name; valueLabel also provides aria-valuetext when formatted values need more context. The 20px thumb grows evenly on hover, keyboard focus, and while pressed, making the active point easier to see without changing the input target. It returns to its resting size on release. Reduced motion removes the transition and size changes.
Choose a value in a familiar bounded 0–100 range.
Show a formatted value while keeping the model numeric.
The native range input supports keyboard adjustments.
<script setup lang="ts">
import { ref } from 'vue'
import Slider from './components/ui/slider/Slider.vue'
const volume = ref(40)
</script>
<template>
<label for="volume">Volume</label>
<Slider id="volume" v-model="volume" name="volume" :min="0" :max="100" show-value />
</template>valueLabel formats the visible and spoken value.
<script setup lang="ts">
import { ref } from 'vue'
import Slider from './components/ui/slider/Slider.vue'
const discount = ref(10)
const percentage = (value: number) => `${value}%`
</script>
<template>
<label for="discount">Discount</label>
<Slider
id="discount"
v-model="discount"
:min="0"
:max="50"
:step="5"
show-value
:value-label="percentage"
/>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
minprop | number | undefined | 0 | Smallest allowed value. |
maxprop | number | undefined | 100 | Largest allowed value. |
stepprop | number | undefined | 1 | Amount added or removed for each adjustment. |
disabledprop | boolean | undefined | Not set | Prevent interaction and show the disabled state. |
sizeprop | ControlSize | undefined | "md" | Choose the visual size. Medium is the usual default where available. |
showValueprop | boolean | undefined | Not set | Show the current numeric value beside the control. |
valueLabelprop | ((value: number) => string) | undefined | Not set | Accessible text describing the current value. |
modelValuemodel | number | undefined | 0 | Current value. Use v-model to keep it in sync with your page. |
update:modelValueevent | [value: number] | — | Requests a new model value from the parent. |
errorslot | { message: string; messages: string[]; } | Optional | Content for the error area of Slider. |
elementexposed | HTMLInputElement | null | — | Reference to the underlying HTML element. |
focusexposed | () => void | undefined | — | Move keyboard focus to this control. |
// packages/frameworks/vue/components/slider/types.ts
import type { ControlSize } from '@getweini/vue/types'
export interface SliderProps {
min?: number
max?: number
step?: number
disabled?: boolean
size?: ControlSize
showValue?: boolean
valueLabel?: (value: number) => string
}
// packages/frameworks/vue/dist/types/index.d.ts
export type { ButtonOptions, ButtonProps } from './button';
export type ControlSize = 'sm' | 'md' | 'lg';
export interface SelectOption<T = unknown> {
label: string;
value: T;
disabled?: boolean;
}
/** Application-owned copy. Bind translated strings reactively when the locale changes. */
export interface ListboxMessages {
/** Popup name when no aria-label or aria-labelledby is supplied. */
listboxLabel: string;
empty: string;
clearSelection: string;
}
export interface ListboxProps<T> {
options: readonly SelectOption<T>[];
messages: ListboxMessages;
id?: string;
disabled?: boolean;
required?: boolean;
invalid?: boolean;
name?: string;
form?: string;
placeholder?: string;
size?: ControlSize;
clearable?: boolean;
gap?: number;
/** Supply stable equality for object values. Values must be unique. */
by?: (a: T, b: T) => boolean;
/** Required for meaningful form submission of object values. */
serialize?: (value: T) => string;
}
// packages/frameworks/vue/dist/types/button.d.ts
import type { Component } from 'vue';
/** Options shared by button implementations across frameworks. */
export interface ButtonOptions<Variant extends string = string, Size extends string = string> {
variant?: Variant;
size?: Size;
disabled?: boolean;
loading?: boolean;
type?: 'button' | 'submit' | 'reset';
}
/** Vue-specific target options extend the reusable button contract. */
export interface ButtonProps<Variant extends string = 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive', Size extends string = 'sm' | 'md' | 'lg'> extends ButtonOptions<Variant, Size> {
as?: 'button' | 'a' | Component;
asChild?: boolean;
}