---
title: "Like Button"
description: "A heart toggle that pops, throws a ring of sparks and rolls its count up when liked, and drains back quietly when unliked."
category: "Micro Interactions"
publishedAt: "2026-11-16"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/micro-interactions/like-button"
markdown: "https://beui.dev/micro-interactions/like-button.md"
license: "MIT"
---

# Like Button

> A heart toggle that pops, throws a ring of sparks and rolls its count up when liked, and drains back quietly when unliked.

## Install

```bash
npx shadcn@latest add @beui/like-button
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

import { LikeButton } from "@/components/motion/like-button";

export function LikeButtonUsage() {
  return <LikeButton count={128} />;
}
```

## API Reference

### LikeButton

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `liked` | `boolean` | — | No | Whether the viewer has liked it, for controlled use. |
| `defaultLiked` | `boolean` | `false` | No | Whether it starts liked when uncontrolled. Default: false |
| `onLikedChange` | `((liked: boolean) => void)` | — | No | Called with the new state when the button is pressed. |
| `count` | `number` | — | No | Likes from everyone else. The viewer's own like is added on top. |
| `labels` | `Partial<{ like: string; }>` | — | No | Override any built-in string, e.g. for translation. |
| `sound` | `boolean` | `false` | No | Play a soft tap on like and unlike. Off by default; a `SoundProvider` can mute it app-wide. |
| `className` | `string` | — | No | Classes merged onto the root element. |

## About Like Button

Like Button is a React heart toggle built with Framer Motion. When liked, the heart fills, pops into place, and throws a ring and six sparks outward while the count rolls up one digit at a time. Unliking drains the fill and rolls the count down without the burst. Pass count for everyone else's likes and the viewer's own like is added on top.

### When to use it

- A social feed, comment thread or gallery needs a like or favorite action.
- A product card wants a wishlist heart with a little delight.
- A changelog or blog wants readers to react to a post.

### Accessibility

It renders a real button with aria-pressed, so screen readers announce it as a toggle named Like. The count has screen reader text. With reduced motion the burst and pop are skipped and only the colour and fill change.

### FAQ

**Does count include the viewer's like?**

No. count is the number of likes from everyone else, and the button adds one while liked. That way toggling never needs you to recompute the total.

**Can I control the liked state?**

Yes. Pass liked and onLikedChange to control it, or defaultLiked to let the button keep its own state.

## Source

- Registry detail: https://beui.dev/r/like-button
- Raw source: https://beui.dev/r/like-button/raw
- GitHub: https://github.com/starc007/ui-components
