Ripple Button

A button that emits a ripple from the exact point clicked.

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

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

3

Turn on the motion

npx @prequelui/cli@latest animate ripple-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.

ripple-button.tsx
import { RippleButton, RippleButtonRipples } from "@/components/prequelui/ripple-button";

export default function Demo() {
  return (
    <RippleButton>
      Click anywhere
      <RippleButtonRipples />
    </RippleButton>
  );
}
import { RippleButton } from "@/components/prequelui/ripple-button";

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

Animation

Each click starts a circle at the exact point of the pointer inside the button. The circle expands to ten times its size while fading from half opacity to nothing, so the wave leaves the surface clean.

  • Ripple: 600 ms ease-out, scale 0 → 10, opacity 0.5 → 0.
  • The origin is corrected for any CSS scaling of the button.
  • Ripples are removed after their tempo-scaled duration.
  • Reduced motion renders the ripple at full size with only the fade.
ripple 600 msscale 0 → 10opacity 0.5 → 0pointer origin

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.

RippleButton

PropTypeDefault
childrenReactNode—
tapScalenumber0.97
hoverScalenumber1
transitionTransitioncomponent spring or tween

RippleButtonRipples

PropTypeDefault
colorstringcurrentColor
scalenumber10
transitionTransitioncomponent spring or tween

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026