Icon Button

An icon button that releases a small burst of particles.

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

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

3

Turn on the motion

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

icon-button.tsx
import { Bell } from "lucide-react";
import { IconButton, IconButtonParticles } from "@/components/prequelui/icon-button";

export default function Demo() {
  return (
    <IconButton aria-label="Notifications">
      <Bell className="size-4" />
      <IconButtonParticles />
    </IconButton>
  );
}
import { IconButton } from "@/components/prequelui/icon-button";

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

Animation

A press releases a small burst around the icon. Eight dots leave from the centre on evenly spaced angles, shrink and fade in 550 ms; the button keeps the shared press spring underneath.

  • Particles: 550 ms ease-out, 24 px travel, scale 0.8 → 0.2.
  • The burst is remounted for every press, so rapid clicks never overlap.
  • Particles are pointer-events none and aria-hidden.
  • Reduced motion emits no particles and keeps the press feedback.
particles 550 mstravel 24 px8 anglesaria-hidden

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.

IconButton

PropTypeDefault
childrenReactNode—
tapScalenumber0.97
classNamestring—

IconButtonParticles

PropTypeDefault
countnumber8
sizenumber4
distancenumber24

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026