Core Components

Slider

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

import { Slider } from "@/components/ui/slider"

export function SliderDemo() {
  return (
    <Slider
      defaultValue={[75]}
      max={100}
      step={1}
      className="mx-auto w-full max-w-xs"
    />
  )
}

Installation

Install with the shadcn CLI. An AI assistant with the shadcn MCP server configured can also install components automatically when you ask for them (see Getting Started).

npx shadcn@latest add slider

Documentation

For all options, variants and the full API, see the shadcn/ui docs and the Base UI API reference.

Last updated on

On this page