Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Elastic Slider

ProNew

Physics-driven slider that stretches elastically past its min and max bounds and snaps back on release.

Installation

pnpm dlx shadcn@latest add @viewport/elastic-slider

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
defaultValuenumber

Initial value between `min` and `max`.

64
minnumber0
maxnumber100
stepnumber1
labelstring

Accessible label for the slider.

"Output volume"
unitstring

Unit suffix shown in the readout, e.g. "%".

"%"
onValueChange(value: number) => void

Called whenever the value changes.

—
classNamestring—

Accessibility

  • Exposed as role=slider with min, max, now, and formatted aria-valuetext.
  • Supports Arrow keys, Shift+Arrow for larger jumps, Home, and End.
  • Elastic overscroll stretching is disabled under reduced motion.