Docs menu

Slider

A candy-filled slider. The heart thumb stretches into a teardrop the faster you drag, like pulled mochi, and sheds hearts behind it. Let go and it snaps back with a ぴたっ.

Moe level64%

Installation

❯ npx shadcn@latest add https://yan.moe/r/slider.json

Usage

tsx
import { Slider } from "@/components/ui/slider"
tsx
<Slider defaultValue={[64]} max={100} step={1} aria-label="Moe level" />

Pass two values for a range:

tsx
<Slider defaultValue={[20, 80]} />

Accessibility

  • Built on Radix Slider: arrow keys, Page Up/Down, Home and End all work, and each thumb is a role="slider".
  • Give it an aria-label or aria-labelledby.
  • The stretch and the trail follow drag speed, and are skipped entirely with prefers-reduced-motion: reduce.

API

PropTypeDefault
intensity

kawaii: speed stretch, heart trail and a ぴたっ on release. subtle: a light stretch and sparkles. off: neither.

"kawaii" | "subtle" | "off""kawaii"
fx

Overrides for the burst fired when a drag ends.

BurstOptions-
value / defaultValue

One entry per thumb.

number[]-
min / max / step

Range and increment.

number0 / 100 / 1
onValueChange / onValueCommit

While dragging, and when the drag ends.

(value: number[]) => void-