Slider

Data input

A value picked by dragging a thumb along a track, or with the arrow keys (Page Up and Down for big steps, Home and End for the ends): type="single" binds a number, type="multiple" a number[] with one thumb each (a range). min, max, step, orientation. Inside a Field the thumbs are named by Field.Label and described by its description and error; outside one, give each thumb a name with aria-label.

import { Slider } from '@limerdev/zest';
Slider for AI tools (llms.txt)
Use for
A value where the rough position matters more than the exact number: volume, a price range filter, a percentage.
Don't
An exact number people type: use Input type="number". Few options: use RadioGroup or ToggleGroup.

Examples

Basic

In a Field, the label names the thumb. Arrow keys move by step.

A range

type="multiple" picks a range with two thumbs; name each thumb outside a Field.

Projects with 20–60 hours logged

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Slider

Prop Type Default Description
autoSort boolean true Whether to automatically sort the values in the array when moving thumbs past one another.
dir "ltr" | "rtl" 'ltr' The direction of the slider. For vertical sliders, setting dir to 'rtl' will caus the slider to start from the top and move downwards. For horizontal sliders, setting dir to 'rtl' will cause the slider to start from the left and move rightwards.
disabled boolean false Whether the slider is disabled or not.
max number 100 (for number step) or the max value of the step array (for array step) The maximum value of the slider.
min number 0 (for number step) or the min value of the step array (for array step) The minimum value of the slider.
onValueChange OnChangeFn<number> | OnChangeFn<number[]> – A callback function called when the value changes.
onValueCommit OnChangeFn<number> | OnChangeFn<number[]> – A callback function called when the user stops dragging the thumb and the value is committed.
orientation "horizontal" | "vertical" 'horizontal' The orientation of the slider.
step number | number[] 1 The amount to increment the value by when the user presses the arrow keys, or an array of specific values that the slider can snap to. When an array is provided, the slider will only allow values that exist in the array, creating discrete tick points. The array values should be within the min/max range and will be automatically sorted.
thumbPositioning "exact" | "contain" "contain" The positioning of the slider thumb.
trackPadding number – Padding percentage for the track. Creates space before the first and after the last tick positions. This can also be used as an SSR-friendly alternative to thumbPositioning="contain", which requires client-side measurement.
type required "multiple" | "single" – The type of slider. If set to 'multiple', the slider will allow multiple ticks and the value will be an array of numbers.
value bindable number | number[] min The value of the slider.