Docs
Slider

Slider

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

This component uses Radix UI
import { cn } from '@/lib/utils'
import { Slider } from 'ui'
 
type SliderProps = React.ComponentProps<typeof Slider>
 
export function SliderDemo({ className, ...props }: SliderProps) {
  return (
    <Slider
      defaultValue={[50]}
      max={100}
      step={1}
      className={cn('w-[60%]', className)}
      {...props}
    />
  )
}

Installation

npx shadcn-ui@latest add slider

Usage

import { Slider } from '@/components/ui/slider'
<Slider defaultValue={[33]} max={100} step={1} />