Button

A button that presses down and never fidgets on hover.

button.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/button.json

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

3

Turn on the motion

npx @prequelui/cli@latest animate button

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.

button.tsx
import { Button } from "@/components/prequelui/button";

export default function Demo() {
  return (
    <Button tapScale={0.97} onClick={() => console.log("pressed")}>
      Get started
    </Button>
  );
}
import { Button } from "@/components/prequelui/button";

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

Animation

The button answers a press and nothing else. It moves to 97% of its size on the same spring every time, then returns to rest; hover only changes colour unless a hover scale is explicitly requested.

  • Press spring: stiffness 550, damping 30, restSpeed 10.
  • Hover scale defaults to 1, so the button never grows under the pointer.
  • Repeated presses retarget the running spring instead of queueing.
  • Reduced motion removes the press scale and keeps the colour change.
spring 550 / 30tap scale 0.97restSpeed 10hover colour only

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

Button

PropTypeDefault
tapScalenumber0.97
hoverScalenumber1
asChildbooleanfalse
transitionTransitioncomponent spring or tween
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026