Command Palette

Search for a command to run...

Slider

An input component for selecting a value from a range.

Value: 50

Installation

npm i @radix-ui/react-slider

Usage

1 2 3 4 5 import { Slider } from "@/components/ui/slider" export function SliderDemo() { return <Slider defaultValue={[50]} max={100} step={1} /> }

Examples

Orientation

Horizontal (default)

Vertical

Range Selection

Single Value

Range

Multiple Values

Disabled

Props

PropTypeDescription
defaultValuenumber[]The default value of the slider (uncontrolled).
valuenumber[]The controlled value of the slider.
onValueChangefunctionEvent handler called when the value changes.
minnumberThe minimum value for the range. Defaults to 0.
maxnumberThe maximum value for the range. Defaults to 100.
stepnumberThe step interval between values. Defaults to 1.
orientation"horizontal" | "vertical"The orientation of the slider. Defaults to "horizontal".
disabledbooleanWhen true, prevents the user from interacting with the slider.