Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Slider for React and Tailwind

A slider for selecting a value from a range.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/slider.json

Anatomy

Slider
├── SliderLabel
├── SliderThumb
├── SliderValue
├── SliderTrack
├── SliderRange
├── SliderControl
├── SliderMarkerGroup
├── SliderMarker
└── SliderDraggingIndicator

Usage

import { Slider } from "@/components/ui/slider";
export const SliderDemo = () => (
  <Slider className="w-full max-w-xs" defaultValue={[20]} />
);

Accessibility

KeyDescription
ArrowUp
Increase the value when orientation is "vertical".
ArrowDown
Decrease the value when orientation is "vertical".
ArrowLeft
Decrease the value when orientation is "horizontal".
ArrowRight
Increase the value when orientation is "horizontal".
PageUp
Increase the value.
PageDown
Decrease the value.
Home
Go to the start.
End
Go to the end.

Demos

Controlled

Disabled

Marks

Min Max

Range

Step

Vertical

With Label

API Reference

Slider

div

PropType
AttributeType

SliderLabel

label

PropType
AttributeType

SliderThumb

div

PropType

SliderValue

span

PropType
AttributeType

SliderTrack

div

PropType

SliderRange

div

PropType

SliderControl

div

PropType

SliderMarkerGroup

div

PropType

SliderMarker

span

PropType

useSlider

PropType