Slider

Pick a value or a range. The track thickens and the thumb grows while you drag.

Playground

Tweak the props, the preview and the code follow.

Props
1
<Slider defaultValue={[50]} showTooltip />

Installation

npx @plumsydev/plum-ui add slider

Also pulls in label automatically.

Usage

import { Slider } from "@/components/ui/slider"
<Slider defaultValue={[50]} max={100} step={1} />

Examples

Value tooltip

showTooltip floats the formatted value above the thumb while dragging.

Range

Pass two values for a range.

$20 – $80

Vertical

API Reference

Slider

Extends Radix Slider.Root.

PropTypeDefault
value

Controlled values, one per thumb.

number[]—
defaultValue

Uncontrolled initial values.

number[][min]
onValueChange

Called while dragging.

(value: number[]) => void—
min / max / step

Range and granularity.

number0 / 100 / 1
showTooltip

Show the value above the thumb while dragging.

booleanfalse
formatValue

Format the tooltip value.

(value: number) => ReactNode—
orientation

Layout direction.

"horizontal" | "vertical""horizontal"