Component librarySlider
Slider
FreeAdjust a value with a pointer, touch or keyboard.
npx shadcn@latest add https://tidalui.com/r/slider.jsonInstallation
Terminal
Import components/ui/tidal.css, components/ui/slider.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.
Usage
Complete example source · Dependency and asset manifest
Loading the complete example…
API & behavior
Required visible label, controlled value:TidalSliderValue ([number] or [number,number]), onValueChange and optional onValueCommit. Initialize with useState<TidalSliderValue>([9,15]); consumers own state, reset and request handling. A single value renders one thumb, an ordered pair renders two; thumb order is preserved with optional nonnegative integer minStepsBetweenThumbs (default0). Radix Slider1.5 owns pointer capture, track clicking, Arrow keys, Page keys, Shift+Arrow, RTL interaction. Tidal submits actual-unit values through named hidden inputs (a pair uses name[]). Home/End moves the focused thumb to its admissible bound, including neighbouring-thumb gap constraints; caller onKeyDown runs first and preventDefault/composition is honored. name/form/native root span attributes and root ref supported; ref targets the track root, query role=slider to focus a thumb. Keyboard and gesture callbacks propose values; consumers may reject proposals and must validate commit values before requests. Horizontal only. min/max default0/100; nonfinite bounds fall back; positive finite step defaults1, malformed step falls back1. Integer-scaled native units preserve decimal gaps and offset step grids; maximum rounds down to its last step. Values must be on the min-based grid. Reversed/equal/unsafe-precision bounds, impossible gap, nonfinite/out-of-bounds/off-grid/unordered values or wrong array length disable the whole slider and expose linked configuration feedback without mutating caller state. Safe fallback geometry is decorative for invalid configuration. disabled/readOnly disables all interaction; disabled or invalid named form inputs are disabled and excluded. Read-only values remain submitted. Optional description/error compose with external aria-describedby; each thumb has localized thumbLabels, aria-valuetext from formatValue and linked invalid feedback. showValue defaults true. marks are decorative bounded unique ticks, capped11; labels compact on narrow tracks, not actions. className/style target Radix track root; rootClassName targets the field. Pointer callbacks compose; reduced motion removes grip scaling, bubbles/digit transitions, track travel. Exports TidalSliderDigits as decorative helper requiring accessible text separately. No momentum, elastic overshoot, network work, wrapper form, storage or scheduling is introduced. Free MIT family; import scoped tidal.css and slider.css.
Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.