Party Popper
PartyPopperIcon is an animated party popper SVG icon built with motion/react that plays a confetti burst when hovered or when its imperative handle is called. It is a lucide-style 24x24 stroke icon whose popper, streamers, and dots animate in on hover.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { PartyPopperIcon } from "@/components/ui/party-popper";export function Example() { return <PartyPopperIcon />;}- Decorating a call-to-action or celebration button (for example a 'Subscribe', 'Launch', or 'Claim reward' action) with a playful hover effect.
- Signaling a successful event, milestone, or launch moment in onboarding or changelog UI.
- Driving the animation programmatically from a parent (for example after a form submit) through the ref handle.
- Adding a lively micro-interaction to a navigation or feature list item where a static lucide icon feels too plain.
Examples
Hover-triggered icon
The default behavior: the animation plays on mouse enter and reverses on mouse leave, with no ref needed.
import { PartyPopperIcon } from "@/components/ui/party-popper";export function HoverExample() { return ( <div className="flex items-center gap-2 text-foreground"> <PartyPopperIcon size={32} /> <span className="font-medium">New release is live</span> </div> );}Programmatic control via ref
Attach a ref to start and stop the animation from parent code. Once a ref is attached, hover no longer animates automatically; the onMouseEnter and onMouseLeave props are called instead.
import { useRef } from "react";import type { PartyPopperIconHandle } from "@/components/ui/party-popper";import { PartyPopperIcon } from "@/components/ui/party-popper";export function ControlledExample() { const iconRef = useRef<PartyPopperIconHandle>(null); return ( <button type="button" className="inline-flex items-center gap-2 rounded-md border px-4 py-2" onClick={() => { iconRef.current?.startAnimation(); window.setTimeout(() => iconRef.current?.stopAnimation(), 1500); }} > <PartyPopperIcon ref={iconRef} size={20} /> Celebrate </button> );}Icon inside a CTA button with custom color
Use className to set the color through Tailwind text utilities, since the stroke is currentColor. Hover on the surrounding button also triggers the icon.
import { PartyPopperIcon } from "@/components/ui/party-popper";export function CtaExample() { return ( <button type="button" className="group inline-flex items-center gap-2 rounded-full bg-violet-600 px-5 py-2 text-white" > <PartyPopperIcon className="text-amber-300" size={22} /> Get started </button> );}Decorative icon with hidden semantics
When the icon is purely decorative, hide it from assistive technology by passing aria-hidden through the wrapper div props.
import { PartyPopperIcon } from "@/components/ui/party-popper";export function DecorativeExample() { return ( <h2 className="flex items-center gap-2 text-xl font-semibold"> <PartyPopperIcon aria-hidden="true" size={24} /> Welcome aboard </h2> );}API reference
Accessibility
- The component renders no role, aria-label, or title. The svg is not hidden by default, so for decorative use pass aria-hidden="true" through props.
- When the icon conveys meaning on its own, add role="img" and aria-label (for example aria-label="Celebration") to the wrapper div via props.
- The wrapper div is not focusable and has no keyboard interaction. Put the icon inside a button or link when it triggers an action, and give that control an accessible name.
- Hover-only animations do not run on touch or keyboard. Ensure the surrounding control's meaning does not depend on the animation.
- The source does not check prefers-reduced-motion. If motion sensitivity matters in your app, gate startAnimation calls or the hover behavior on a media query check in the parent.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Party Popper" component (lucide-animated/party-popper) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/party-popper.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, className, ref, onMouseEnter, onMouseLeave, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { PartyPopperIcon } from "@/components/ui/party-popper";export function Example() { return <PartyPopperIcon />;}```Files & dependencies
- party-popper.tsx