Slider

Continuous value selector on bits-ui Slider. The thumb springs under press with a snappy preset and collapses to an instant snap under reduced-motion — the track fills as a range between thumbs.

Install

import { Slider } from '$lib/components/ui/slider';

Usage

48

Range

20 – 80

Vertical

64

Steps

showSteps renders a dot at every step position. Bounded dots (left of the thumb) carry data-bounded for contrast.

40

Value Display

Label on the left, formatted value on the right — the bloom-nx idiom for the label-plus-readout composition.

72%

Format

formatValue shapes the readout — percent, currency, or any caller-supplied formatter.

75%
$1,250

Tooltip

Pair tooltip with formatValue to float the value above the thumb on hover, focus, and drag.

States

API reference

Inherits bits-ui Slider.Root props via spread. Discriminated unions + destructuring force value to be cast to never for type-checker peace — usage is unchanged.

PropTypeDescription
'single' | 'multiple'Whether the slider has one thumb (single → value is a number) or many (multiple → value is number[]).
number | number[] (bindable)Current thumb position(s). Two-way bindable.
numberLower bound of the track.
numberUpper bound of the track.
numberSnap granularity between min and max.
'horizontal' | 'vertical'Track axis. Vertical reverses thumb drag direction.
booleanDisables every thumb in the group and drops opacity to 50%.
booleanRender a dot at every step. Bounded dots (left of the thumb) read at higher contrast via the bits-ui data-bounded attribute.
booleanFloat a tooltip above each thumb on hover, focus-visible, and drag. The label uses formatValue.
(v: number) => stringShapes the tooltip label. Pair with Intl.NumberFormat for percent / currency / locale formatting.
(v) => voidFires on every value change while dragging. Pass-through to bits-ui Slider.Root.
(v) => voidFires once on drag end (commit). Pass-through to bits-ui Slider.Root.
string[]Accessible names for each thumb (passed through to aria-label). For range sliders provide one entry per thumb.
HTMLSpanElement | nullTwo-way-bindable element reference.
stringMerged onto the root via tailwind-merge.