Drag to adjust the display brightness.
npx shadcn@latest add https://sdk-components.thesqd.com/r/slider.jsonimport { Slider, type SliderVariant } from "@/components/ui/slider";import { Slider } from "@/components/ui/slider";
export function Example() {
return <Slider label="Opacity" defaultValue={20} unit="%" />;
}Slider (single component — pass everything as props)
├── variant="default | ticks"
├── label={<ReactNode>} (text shown above the track / inside the ticks track)
├── caption={<ReactNode>} (helper text below the track)
├── value | defaultValue (number for single, number[] for range)
├── onValueChange={(v) => …} (controlled handler)
├── min / max / step (numeric bounds and increment)
├── unit="%" | "dB" | … (suffix appended to the displayed value)
├── formatValue={(v) => …} (full control over the rendered value)
├── showValue={boolean} (toggle the live value, default true)
├── prefixIcon / suffixIcon (icons rendered either side of the track, default variant)
├── ticks={number} (number of evenly-spaced tick marks, ticks variant)
├── orientation="horizontal | vertical"
└── disabled (read-only + muted styling)Drag to adjust the display brightness.
Step in 10
Brightness of the image
Current temperature: 31°
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "ticks" | "default" | Visual treatment. `default` is the classic label-above + 1.5-high bar. `ticks` is the compact 10-high inline bar with label/value inside the track. |
label | ReactNode | — | Field label. Rendered above the track (default) or inside the track on the left (ticks). |
caption | ReactNode | — | Helper text rendered below the track. |
value | number | number[] | — | Controlled value. Pass an array of length 2 for a range slider. |
defaultValue | number | number[] | — | Uncontrolled initial value. |
onValueChange | (value: number | number[]) => void | — | Called as the user drags or keys the slider. |
min | number | 0 | Minimum value. |
max | number | 100 | Maximum value. |
step | number | 1 | Increment between selectable values. |
unit | string | — | Suffix appended to the displayed value (e.g. `%`, `°`, `dB`). |
formatValue | (value: number | number[]) => ReactNode | — | Full control over the rendered value. Overrides `unit` when provided. |
showValue | boolean | true | Toggle the live value display. |
prefixIcon | ReactNode | — | Icon rendered to the left of the track (default variant only). |
suffixIcon | ReactNode | — | Icon rendered to the right of the track (default variant only). |
ticks | number | 11 | Number of evenly-spaced tick marks (ticks variant). |
orientation | "horizontal" | "vertical" | "horizontal" | Layout orientation. |
disabled | boolean | — | Disable interaction and dim the slider. |
className | string | — | Override or extend the resolved variant classes. |