Back to catalog
Component detail entry
Forms
@vean/ui
SSlider

Slider

Slider belongs to the Forms category. Start with demos and usage, then use the API tables to finish integration and styling decisions.

Use the quick jump panel to reach overview, usage, demos, and API first, then continue through the full page.

Quick jump

Related components

If you are composing interactions in the same family, these components usually pair well together.

Slider

Overview

A slider for picking one or more numeric values within a continuous range, supporting horizontal and vertical orientations, multi-thumb range mode, RTL and inverted directions, and complete keyboard navigation. Use it when the value belongs to a bounded numeric range and the user should adjust it with mouse or keyboard precision; when the value is free-form text or numbers, prefer SInputNumber instead.

Usage

Features

  • 🎚 modelValue / defaultValue — controlled and uncontrolled modes backed by useControllableState
  • 🔢 Single or multi-thumb range — pass an array with two values for a range slider
  • ⌨️ Full keyboard support — Arrow keys step by step, PageUp/PageDown and Shift+Arrow jump 10 steps, Home/End go to min/max
  • ↔ RTL-aware direction with dir, plus inverted to flip the value direction
  • 📐 Horizontal and vertical orientations with aria-orientation reflection
  • 📋 Native form proxy — a visually hidden input (or name[0]/name[1] pair for ranges) carries the value with name / required
  • 🎨 6 sizes and 8 colors via sliderVariants
  • 🧩 trackProps / rangeProps / thumbProps forwarding plus a default slot to customize thumb content
  • 📏 minStepsBetweenThumbs and thumbAlignment (contain / overflow) for precise range control

Demos

Basic

40

API

Aria Layer

6

Slider

22 Props2 Emits
Props
PropTypeDefaultDescription
class
ClassValue
—
Additional class names applied to the root element.
color
ThemeColor
—
Theme color of the component.
size
ThemeSize
—
Visual size of the component.
ui
Partial<SliderUi>
—
Per-slot class overrides for the component.
trackProps
SliderTrackProps
—
Properties forwarded to the track element.
rangeProps
SliderRangeProps
—
Properties forwarded to the range element.
thumbProps
BaseProps
—
Properties forwarded to the thumb element.
modelValue
number[]
—
The controlled value of the slider. Can be bind as `v-model`.
defaultValue
number[]
—
The initial value of the slider when uncontrolled.
disabled
boolean
—
Whether the slider is disabled.
orientation
DataOrientation
—
The orientation of the slider.
dir
Direction
—
The reading direction of the slider.
inverted
boolean
—
Whether the slider value direction is inverted.
min
number
—
The minimum value.
max
number
—
The maximum value.
step
number
—
The stepping interval.
minStepsBetweenThumbs
number
—
The minimum permitted steps between multiple thumbs.
thumbAlignment
SliderThumbAlignment
—
Whether thumbs stay within the track bounds or may overflow it.
name
string
—
The name of the field. Submitted with its owning form as part of a name/value pair.
required
boolean
—
When `true`, indicates that the user must set the value before the owning form can be submitted.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`
Emits
Emit NameParametersDescription
update:modelValue
number[]
Event handler called when the slider value changes.
valueCommit
number[]
Event handler called when a slider interaction is committed.

SliderCompact

18 Props2 Emits1 Slots
Props
PropTypeDefaultDescription
trackProps
SliderTrackProps
—
Properties forwarded to the track element.
rangeProps
SliderRangeProps
—
Properties forwarded to the range element.
thumbProps
BaseProps
—
Properties forwarded to the thumb element.
modelValue
number[]
—
The controlled value of the slider. Can be bind as `v-model`.
defaultValue
number[]
—
The initial value of the slider when uncontrolled.
disabled
boolean
—
Whether the slider is disabled.
orientation
DataOrientation
—
The orientation of the slider.
dir
Direction
—
The reading direction of the slider.
inverted
boolean
—
Whether the slider value direction is inverted.
min
number
—
The minimum value.
max
number
—
The maximum value.
step
number
—
The stepping interval.
minStepsBetweenThumbs
number
—
The minimum permitted steps between multiple thumbs.
thumbAlignment
SliderThumbAlignment
—
Whether thumbs stay within the track bounds or may overflow it.
name
string
—
The name of the field. Submitted with its owning form as part of a name/value pair.
required
boolean
—
When `true`, indicates that the user must set the value before the owning form can be submitted.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`
Emits
Emit NameParametersDescription
update:modelValue
number[]
Event handler called when the slider value changes.
valueCommit
number[]
Event handler called when a slider interaction is committed.
Slots
Slot NameParametersDescription
default
SliderCompactSlotProps
Custom content for the default slot.

SliderRange

2 Props
Props
PropTypeDefaultDescription
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

SliderRoot

15 Props2 Emits
Props
PropTypeDefaultDescription
modelValue
number[]
—
The controlled value of the slider. Can be bind as `v-model`.
defaultValue
number[]
—
The initial value of the slider when uncontrolled.
disabled
boolean
—
Whether the slider is disabled.
orientation
DataOrientation
—
The orientation of the slider.
dir
Direction
—
The reading direction of the slider.
inverted
boolean
—
Whether the slider value direction is inverted.
min
number
—
The minimum value.
max
number
—
The maximum value.
step
number
—
The stepping interval.
minStepsBetweenThumbs
number
—
The minimum permitted steps between multiple thumbs.
thumbAlignment
SliderThumbAlignment
—
Whether thumbs stay within the track bounds or may overflow it.
name
string
—
The name of the field. Submitted with its owning form as part of a name/value pair.
required
boolean
—
When `true`, indicates that the user must set the value before the owning form can be submitted.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`
Emits
Emit NameParametersDescription
update:modelValue
number[]
Event handler called when the slider value changes.
valueCommit
number[]
Event handler called when a slider interaction is committed.

SliderThumb

3 Props
Props
PropTypeDefaultDescription
index
number
—
The thumb index in the current slider value array.
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

SliderTrack

2 Props
Props
PropTypeDefaultDescription
asChild
boolean
—
Change the default rendered element for the one passed as a child, merging their props and behavior.
as
AsTag | Component
'div'
The element or component this component should render as. Can be overwrite by `asChild`

Notes

Architecture and benchmark differences

VeanUI builds the slider from Aria SliderRoot (useControllableState + value normalization + VisuallyHiddenInput form proxy) → SliderTrack (pointer drag, pointer-move/up/cancel on the document) → SliderRange (percentage span between thumbs) → SliderThumb (role="slider" + aria-valuemin/max/now + aria-orientation, focus-derived step navigation). SliderCompact composes root + track + range + thumbs and owns thumb iteration; the UI wrapper SSlider only computes variant classes via sliderVariants and injects the ui map through provideSliderUi.

CapabilityVeanUIAnt Design SliderElement Plus SliderMantine SliderNaive UI Slidershadcn Slider
Aria/styled split✅————✅
Controlled/uncontrolled✅✅✅✅✅✅
Range (multi-thumb)✅✅✅✅✅✅
Vertical orientation✅✅✅✅✅✅
Inverted / RTL✅✅✅✅✅✅
Keyboard nav (Arrows/Home/End/Page)✅✅✅✅✅✅
minStepsBetweenThumbs✅————✅
Form proxy / name submit✅✅✅✅✅✅
Axe-clean✅—————
Marks (scale ticks)➕✅✅✅✅—
Value tooltip while dragging➕✅✅✅✅—
Linked number input➕✅————

Cautions

  • A single thumb has no default accessible name — pass aria-label through thumbProps (range mode falls back to localized “Minimum”/“Maximum” labels automatically).
  • Thumbs default to contain inside the track; thumbAlignment="overflow" lets them extend beyond the track bounds.
  • The form proxy renders only when name is present on a form-classed root; pair it with a native <form> or the SForm integration.
  • PageUp/PageDown and Shift+Arrow keys step 10× the step value; minStepsBetweenThumbs blocks thumbs from crossing each other.

FAQ

How do I create a range slider?

Pass an array with two values to modelValue (or defaultValue), e.g. [20, 80]. Two thumbs are rendered and valueCommit emits both values. Each thumb is labeled “Minimum”/“Maximum” (localized) unless you override thumbProps['aria-label'].

How do I keep the two thumbs apart?

Set minStepsBetweenThumbs to the minimum number of steps between thumbs — stepping or dragging is rejected when the gap would fall below that threshold.

How do I show the current value above the thumb?

Use the default slot, which receives { index, value, modelValue } for each thumb, to render custom content. A built-in tooltip is a planned enhancement.

What keyboard shortcuts are supported?

Arrow keys step by step, PageUp/PageDown and Shift+Arrow jump 10 steps, and Home/End jump to min/max. Direction keys follow dir and inverted (RTL flips horizontal arrows; inverted flips the value direction).

Changelog

Version history is grouped by release so you can quickly see what changed for this component across published versions.

v0.19.0

2026-05-11

Compare release

Feature

Implement SliderCompact

Scope: sliderAuthors: soybeanjs, CopilotKit, soybeanfeView commit6eba7

Fix

update thumbProps type to BaseProps for consistency

Scope: sliderAuthors: soybeanfeView commit87994

v0.15.0

2026-04-26

Compare release

Optimization

clean up props handling and improve readability

Scope: sliderAuthors: soybeanjsView commit012f2

Optimization

clean up props handling and improve readability

Scope: sliderAuthors: soybeanjsView commit012f2