Slider

An input that allows users to select a value or range from a given range.

inputs
range
selection
numeric

Preview

Variants

Basic slider with a single thumb.

Code

TSX
1
2
3
4
5
import { Slider } from "@/components/ui/slider"

export function SliderDemo() {
  return <Slider defaultValue={[33]} max={100} step={1} />
}

API Reference

PropTypeDefaultDescription
defaultValuenumber[]-The initial value of the slider.
valuenumber[]-The controlled value of the slider.
onValueChangefunction-Event handler called when the value changes.
minnumber0The minimum value of the slider.
maxnumber100The maximum value of the slider.
stepnumber1The stepping interval.
orientationhorizontal | verticalhorizontalThe orientation of the slider.