Like Button
A heart button that pops with a particle burst and rolling count.
@spectrumui/like-button
Tap a heart — spring pop, ring pulse, particle burst and a rolling count
Login to view codeCreate a free account to access component source code
Installation
Login to view commandCreate a free account to access the install command
Usage
import { LikeButton } from "@/components/spectrumui/like-button"<LikeButton count={128} onLikedChange={(liked) => console.log(liked)} />API Reference
LikeButton
Renders a single button element with aria-pressed reflecting the liked state. Pass liked to control it from outside, or defaultLiked to let it manage its own state.
| Prop | Type | Default | Description |
|---|---|---|---|
liked | boolean | - | Controlled liked state. Leave undefined for uncontrolled usage |
defaultLiked | boolean | false | Initial liked state when uncontrolled |
onLikedChange | (liked: boolean) => void | - | Fires with the next liked state on every toggle |
count | number | - | Like total excluding the current user; +1 is shown while liked. Totals of 1000+ are compacted (1.2K) |
showCount | boolean | true | Hide the rolling counter even when count is set |
size | "sm" | "md" | "lg" | "md" | Visual size of the button |
particleColors | string[] | - | Colors cycled across the burst particles |
label | string | "Like" | Accessible name of the action |
disabled | boolean | false | Disables pointer and keyboard interaction |
className | string | - | Additional classes merged with the default button styles |
Examples
Sizes
Login to view codeCreate a free account to access component source code