Like Button

A heart that pops and bursts into particles, with a rolling count.

no dependenciesMIT · free

Installation

npx shadcn@latest add https://ombakui.com/r/like-button.json

Usage

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

<LikeButton count={128} onChange={(liked, count) => save(liked)} />

Props

PropTypeDefaultDescription
countnumber0Starting like count.
defaultLikedbooleanfalseStart in the liked state.
onChange(liked: boolean, count: number) => void–Called with the new state after each toggle.
colorstring"#f43f5e"Heart and burst color.
classNamestring–