Slider

A thin capsule track with the macOS 27 pill knob. Supports ranges and tick marks.

Installation

pnpm dlx shadcn@latest add @cupertinoui/slider

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { Slider } from "@/components/ui/slider"

<Slider defaultValue={[40]} aria-label="Volume" />

Examples

Range

Pass two values to get two knobs.

Tick marks

The labelled style of System Settings, composed from the slider and plain markup.

API Reference

Every part forwards the props of the underlying Base UI Slider part. The props below are the ones CupertinoUI adds or changes.

Slider

PropTypeDescription
defaultValuenumber[]The initial value; one entry per knob.
valuenumber[]The controlled value.
onValueChange(value: number[]) => voidCalled while the knob moves.
min / max / stepnumber
Default: 0 / 100 / 1
The range and step.
orientation"horizontal" | "vertical"
Default: "horizontal"
The direction of the track.
classNamestringExtra classes, merged with the component's own.