Components / Choice

Slider

Single-value or dual-thumb range slider with steps, tick marks and keyboard control.

@ruckc/truss-ui Choice

Import

import { Slider } from '@ruckc/truss-ui';

Playground

step
bounds

API

PropTypeDefaultDescription
value bindable number | [number, number] | null0A number for a single thumb, or [low, high] for a range.
min number0Minimum allowed value.
max number100Maximum number to show before collapsing the rest.
step number1Increment between values.
label string—Visible label shown above the control.
ariaLabel string—Accessible name, for use when there is no visible `label`.
format (n: number) => string(n: number) => String(n)Formats a number for display.
marks booleanfalseShow a tick per step (when there are ≤ 50).
numberInput booleanfalseShow a number box synced with the slider, inside the same labelled control (the box takes its accessible name from `label` / `ariaLabel`). Single-value sliders only: a range slider ignores it (use two NumberInputs for exact range entry).
inputMin number—Lowest number the box accepts. Defaults to `min`; set it lower to let the box go past the track.
inputMax number—Highest number the box accepts. Defaults to `max`. The thumb stays on the track while the bound value keeps the typed number.
nullable booleanfalseLet the value be `null` ("off"). A built-in switch named "Enable <label>" is added to the same labelled control; while off, the thumb rests at the start of the track, the value reads `offLabel` and the slider and number box are inert. Single-value sliders only: a range slider ignores it.
offLabel string'Off'Text shown instead of the value while a `nullable` slider is off. Defaults to "Off".
defaultValue number—What switching a `nullable` slider on restores when there is no earlier value to return to. Falls back to `min`.
disabled booleanfalseDisables the control: it cannot be focused, changed or activated.
/docs/slider Truss UI · MIT