Search

Search documentation

Slider

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

Installation

›pnpm dlx shadcn@latest add @evolphin/slider

Usage

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

Type Definitions

interface SliderProps {
  /** The value of the slider when initially rendered */
  defaultValue?: number[];
SliderProps.defaultValue?: number[] | undefined

The value of the slider when initially rendered

/** The controlled value of the slider */ ?: number[]; /** The minimum value for the range */ ?: number; /** The maximum value for the range */ ?: number; /** The stepping interval */ ?: number; /** Event handler called when the value changes */ ?: (: number[]) => void; }

Examples

Default

API Reference

Slider

PropTypeDefaultDescription
defaultValuenumber[]-The value of the slider when initially rendered.
valuenumber[]-The controlled value of the slider.
onValueChange(value: number[]) => void-Event handler called when the value changes.
minnumber0The minimum value for the range.
maxnumber100The maximum value for the range.
stepnumber1The stepping interval.
classNamestring-Additional CSS classes

On this page