Get Started

How animated icons work, whatever the icon library. Each icon is a file in your project, animated by one small core from @animate-ui/react.

Installation

Add icons one by one from your icon library's page (Lucide Icons or Hugeicons), here Lucide's Bell. Each icon is a file in your project; the core that animates them comes from @animate-ui/react/icons, which the CLI installs with the first icon.

npx shadcn@latest add @animate-ui/icons-lucide-bell
pnpm dlx shadcn@latest add @animate-ui/icons-lucide-bell
yarn dlx shadcn@latest add @animate-ui/icons-lucide-bell
bun x shadcn@latest add @animate-ui/icons-lucide-bell

Usage

An icon animates on its own trigger:

import { Bell } from '@/components/animate-ui/icons/bell';

<Bell animateOnHover />;

Or let a parent decide, so hovering a whole button animates its icon:

import { AnimateIcon } from '@animate-ui/react/icons';

<AnimateIcon animateOnHover asChild>
  <button>
    <Bell /> Notifications
  </button>
</AnimateIcon>;

Icons inside an AnimateIcon inherit its props and can override them individually.

Triggers

  • animate: animates while true (or plays the named animation).
  • animateOnHover: animates while the pointer is over the icon, and returns to rest when it leaves. A touch doesn't play it (a finger can't leave): add animateOnTap for touch screens.
  • animateOnTap: animates while pressed, and returns to rest on release or when the pointer leaves. Add completeOnStop to always finish the animation.
  • animateOnView: plays when the icon scrolls into view (animateOnViewMargin, animateOnViewOnce).

Animations

Every icon has a default animation, often a few named ones, plus path (draws the strokes) and path-loop. Pick one with animation; the Lucide Icons and Hugeicons pages list each icon's. Icons drawing their strokes add one small CSS rule to the page themselves, so their paths rest solid: no Tailwind setup needed.

<ArrowRight animateOnHover animation="pointing" />

Timing

  • speed: playback rate (2 is twice as fast). At 1, the default, icons play exactly as authored. It follows AnimateUIProvider's tempo.
  • delay: milliseconds before the animation starts.
  • loop, loopDelay: repeat, with a pause between iterations. Off screen, a loop waits after its current lap until the icon is back in view.

Persistence

  • persistOnAnimateEnd: stay in the animated state when it ends.
  • initialOnAnimateEnd: jump back to the initial state, without transition, when it ends.
  • completeOnStop: finish the current animation before returning to rest.

Under reduced motion, icons don't animate.

API Reference

PropTypeDefault
size?
number28
animation?
'default' | 'path' | 'path-loop' | string'default'
animate?
boolean | stringfalse
animateOnHover?
boolean | stringfalse
animateOnTap?
boolean | stringfalse
animateOnView?
boolean | stringfalse
animateOnViewMargin?
string'0px'
animateOnViewOnce?
booleantrue
speed?
number1
delay?
number0
loop?
booleanfalse
loopDelay?
number0
persistOnAnimateEnd?
booleanfalse
initialOnAnimateEnd?
booleanfalse
completeOnStop?
booleanfalse

AnimateIcon takes the same props (except size), plus asChild to animate through its child element.

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/19/2026