Slider

A range slider whose thumb stretches in the direction of travel.

slider.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/slider.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/slider.json

3

Turn on the motion

npx @prequelui/cli@latest animate slider

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

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

export default function Demo() {
  return (
    <Slider>
      {/* compose the parts exactly like the underlying primitive */}
    </Slider>
  );
}
import { Slider } from "@/components/prequelui/slider";

export function Variant() {
  return (
    <Slider tempo={1.2}>
      …
    </Slider>
  );
}

Animation

This primitive keeps the API and semantics of the underlying component and adds motion at the surface edges. Entrances are slower and more settled than exits, so closing never feels like waiting.

  • Springs for position, scale and size; tweens for colour and opacity.
  • The exit is shorter than the entrance, and keeps the current position as its starting point.
  • All measurements are taken again when content or font metrics change.
  • With reduced motion, the surface fades in place and never travels.
spring 300 / 30exit 150 msblur 4 pxheight 450 ms

API Reference

Every part takes exactly the props of the Slider primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.

Slider

PropTypeDefault
childrenReactNode—
disabledbooleanfalse
transitionTransitionspring.press
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026