Skip to main content

Slider

An input where the user selects a value from within a given range.

On this page
Props
orientation
<Slider defaultValue={50}>
  <Label>Volume</Label>
  <SliderControl />
</Slider>

Installation

npx shadcn@latest add @dotui/slider

Usage

Use slider to allow users to select a value from within a given range.

import { Slider, SliderControl } from '@/components/ui/slider'
<Slider defaultValue={50}>
  <SliderControl />
</Slider>

Examples

Adjust the background opacity.
50 of 100 Donuts
¥60
200 - 300
50
Adjust the volume.
Value: 50

API Reference

Slider

A slider allows a user to select one or more values within a range.

PropType
ReactNode | function
boolean
Orientation
number | number[]
number | number[]
function
function
NumberFormatOptions

SliderControl

A slider control is the interactive surface that positions the track and thumbs.

PropType
ReactNode | function

SliderTrack

A slider track is the visual track that contains the selected fill.

Supports all div attributes.

PropType

SliderFill

A slider fill displays the selected region of the track.

PropType
ReactNode | function

SliderThumb

A slider thumb represents an individual value that the user can adjust within a slider track.

PropType
ReactNode | function
number
RefObject<HTMLInputElement | null>
boolean
Orientation

SliderOutput

A slider output displays the current value of a slider as text.

PropType
ReactNode | function

Last updated on 6/16/2026