Slider
An input where the user selects a value from within a given range.
Installation
pnpm dlx cubix@latest add slider --base ariaUsage
import { Slider } from "@/components/cubix/slider"<Slider defaultValue={[33]} max={100} step={1} />Range
Use an array with two values for a range slider.
Multiple Thumbs
Use an array with multiple values for multiple thumbs.
Vertical
Use orientation="vertical" for a vertical slider.
Controlled
0.3, 0.7
Disabled
Use the disabled prop to disable the slider.
RTL
Wrap the slider in a container with dir="rtl" to mirror direction.
API Reference
See also the Base UI Slider documentation for primitive props.
Slider
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue | number | number[] | - | Uncontrolled initial value. Use a single-item array for one thumb, or multiple values for a range. |
| value | number | number[] | - | Controlled value. Thumb count matches the array length. |
| onValueChange | (value: number | number[], eventDetails?) => void | - | Called while the value changes (for example during drag). |
| onValueCommitted | (value: number | number[], eventDetails?) => void | - | Called when a change is committed (Base UI). Radix uses onValueCommit. |
| min | number | 0 | Minimum allowed value. |
| max | number | 100 | Maximum allowed value. |
| step | number | 1 | Step increment when adjusting the value. |
| orientation | "horizontal" | "vertical" | "horizontal" | Layout orientation of the slider. |
| disabled | boolean | false | When true, interaction is disabled. |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |