Like Burst, animated React component
A like button whose heart squashes and fills with a ring shockwave and a particle burst, while the count rolls digit by digit.
- Free
- Inputs & Controls
- Spring
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| count | number | — | Controlled like count. |
| defaultCount | number | 1299 | Starting count when uncontrolled. |
| liked | boolean | — | Controlled liked state. |
| defaultLiked | boolean | false | Starting liked state when uncontrolled. |
| onChange | (liked: boolean, count: number) => void | — | Called with the next liked state and count. |
| color | string | "#ff3b5c" | Heart, ring and particle colour. |
| size | "sm" | "md" | "lg" | "md" | Button size. |
| burst | number | 10 | Particles in the burst; 0 turns it off. |
| label | string | "Like" | Accessible label; the count is appended. |
| className | string | — | Extra classes on the button. |
Add it to your project
- 1
Prepare your project
You need Tailwind CSS and the
@/import alias. If shadcn isn't set up yet, initialise it once:npx shadcn@latest init
Then add the Nexus registry to your
components.json(theregistrieskey is the part that matters):{ "$schema": "https://ui.shadcn.com/schema.json", "style": "default", "rsc": true, "tsx": true, "tailwind": { "css": "src/app/globals.css", "baseColor": "neutral", "cssVariables": true, "prefix": "" }, "aliases": { "components": "@/components", "utils": "@/lib/utils", "ui": "@/components/ui", "lib": "@/lib", "hooks": "@/hooks" }, "registries": { "@nexus-labs": "https://www.nexus-ui.com/api/registry/{name}" } } - 2
Add the component
Run this from your project root. It adds the component, the utilities it uses and its packages.
npx shadcn@latest add @nexus-labs/like-burst
- 3
Check what was added
With the standard aliases, these files land in your project:
components/like-burst/index.tslike-burst.tsx - 4
Copying by hand? Install the packages
Skip this if you used the command above.
npm install framer-motion lucide-react
- 5
Use it in a page
Import it and render it. The Code tab above has the full example.
// app/page.tsx import { LikeBurst } from "@/components/like-burst"; export default function Page() { return ( <main> <LikeBurst /> </main> ); }