Slider

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

<Slider aria-label="Opacity" defaultValue={50}>
  <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>

Playground

Use the controls below to experiment with different slider props and see the live preview and code update.

orientation
<Slider defaultValue={50}>
  <Label>Volume</Label>
  <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
DOMRenderFunction<"div", SliderRenderProps>
number | number[]
number | number[]
function
function
NumberFormatOptions

SliderControl

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

PropType
ReactNode | function
DOMRenderFunction<"div", SliderTrackRenderProps>

SliderTrack

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

Supports all div attributes.

SliderFill

A slider fill displays the selected region of the track.

PropType
ReactNode | function
DOMRenderFunction<"div", SliderFillRenderProps>

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
DOMRenderFunction<"div", SliderThumbRenderProps>

SliderOutput

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

PropType
ReactNode | function
DOMRenderFunction<"output", SliderRenderProps>

Last updated on 5/22/2026