createSlider API
API reference for the createSlider composable.
Functions
createSlider
(options?: SliderOptions) => SliderContextCreates slider state with value math, step snapping, and multi-thumb support. Extends createModel for useProxyModel compatibility. Each thumb is a model ticket with a shallowRef<number> value. Values are derived from the ordered tickets, enabling proper registration/unregistration lifecycle.
Options
step
number | undefinedStep increment. Values are snapped to the nearest multiple of `step` above `min`.
Default: 1
readonly
MaybeRefOrGetter<boolean> | undefinedWhether the slider is readonly (focusable but not editable).
Properties
disabled
Readonly<Ref<boolean, boolean>>Whether disabled. Reactive ref derived from the `disabled` option.
readonly
Readonly<Ref<boolean, boolean>>Whether readonly. Reactive ref derived from the `readonly` option.
orientation
Readonly<Ref<"horizontal" | "vertical", "horizontal" | "vertical">>Slider orientation. Reactive ref derived from the `orientation` option.
inverted
Readonly<Ref<boolean, boolean>>Whether inverted. Reactive ref derived from the `inverted` option.
Methods
apply
(values: unknown[], options?: { multiple?) => voidApply external values — snaps, constrains, and writes to ticket refs.
register
(input?: number | { value) => ModelTicket<SliderTicketInput>Register a new thumb and return its ticket.
set
(index: number, value: number) => voidSet the value at a thumb index with step snapping and neighbor constraints.