Menu

Slider

Value & range picker. 2 types × 4 states.

Installation

$ npx uix-ui@latest add slider

This copies the file into components/ui/slider.tsx in your project. npx shadcn@latest add @uix/slider works too.

Usage

slider.tsx
import { Slider } from "@/components/ui/slider";

<div style={{ width: 320, display: "grid", gap: 20 }}>
  <Slider aria-label="Sweetness" defaultValue={30} />
  <Slider aria-label="Strength" defaultValue={80} />
  <Slider aria-label="Locked" defaultValue={50} disabled />
</div>

Examples

Values and disabled

Props

PropTypeDefaultDescription
valuenumber–
defaultValuenumber–
onChange(event: React.ChangeEvent<HTMLInputElement>) => void–

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
esc

↑↓ to navigate · ↵ to select · esc to close