Components / Buttons
Like Button
A heart that pops with a burst of particles, plus an optional rolling counter.
Installation
Requires React 18+ and Tailwind CSS.
- 1
Install dependencies
$ npm install motion - 2
Add the component
Copy the code from the Code tab above into
components/ui/like-button.tsx. - 3
Use it
example.tsximport { LikeButton } from "@/components/ui/like-button"; export default function LikeButtonDemo() { return <LikeButton count={1284} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| liked | boolean | — | Controlled state. Omit to let it manage itself. |
| defaultLiked | boolean | false | Starting state when uncontrolled. |
| onChange | (liked: boolean) => void | — | Called when toggled. |
| count | number | — | Like count, not including the viewer's like. |