Controls

Slider

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Slider
Warmth62%

Slider

A slider made of tick marks that swell under your pointer.

Installation

npx shadcn@latest add ikislay/pixel-ui/slider

How to use

import { Slider } from "@/components/ui/slider"
export function Demo() {
return <Slider aria-label="Volume" defaultValue={40} formatValue={(v) => `${v}%`} />
}

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
value
number

Controls the value. Leave it unset to let the slider manage itself.

defaultValue
number

The starting value when uncontrolled. Defaults to min.

min
number

The lowest value.

max
number

The highest value.

step
number

The size of each step.

ticks
number

How many tick marks draw the track.

formatValue
(value: number) => string

Formats the number in the tag and for screen readers, for example as a percentage.

onValueChange
(value: number) => void

Called on every step while the value moves.

onFeedback
(event: "select") => void

Called at each semantic moment, for wiring sound or haptics.

className
string

Merged onto the capsule. Other props, like aria-label, go to the inner range input.