Slider
An input where the user selects a value from within a given range.
Installation
terminal
npx felicityui add slider --platform reactUsage
example.tsx
import { Slider } from "@/components/ui/slider"
<Slider defaultValue={[33]} max={100} step={1} />Composition
Slider ├── track ├── range └── thumb(s)
Default
Single thumb on a ruled track with copper fill.
Range
Two values for a range slider.
Multiple thumbs
An array with more than two values.
Vertical
orientation=vertical.
Controlled
value + onValueChange.
40
Disabled
disabled prevents interaction.
RTL
Logical positioning and mirrored keys under dir=rtl.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | number[] | — | Controlled value(s). |
| defaultValue | number | number[] | — | Uncontrolled initial value(s). |
| onValueChange | (value: number[]) => void | — | Called when value(s) change. |
| min | number | — | Minimum value. Default 0. |
| max | number | — | Maximum value. Default 100. |
| step | number | — | Increment. Default 1. |
| orientation | "horizontal" | "vertical" | — | Track orientation. |
| disabled | boolean | — | Disables all thumbs. |
| label | ReactNode | — | Optional visible label. |
| description | ReactNode | — | Optional helper text. |
| className | string | — | Additional classes on the root. |
Accessibility
WCAG 2.2 AA
- Each thumb is
role=sliderwitharia-valuemin/max/now. - Arrow keys, Home/End, PageUp/PageDown adjust value.
- Visible
focus-visiblering on thumbs. - RTL mirrors horizontal pointer and arrow keys.
Platform notes
React
Custom multi-thumb slider with Felicity semantic tokens. Copper range fill — not Base UI / Radix runtime.
- Client component (pointer drag + keyboard).
- Uses
data-slot=slider|slider-control|slider-track|slider-range|slider-thumb. - value/defaultValue are number or number[]; onValueChange always receives number[].
- Supports range, multiple thumbs, vertical orientation, and RTL via logical positioning.