Loading component…
Loading component…
Like, comment, repost and share in one pill
To reuse this local React demo, copy all files from the Code tab into the same folder, then import ReactionBar from ./reaction-bar.
import { ReactionBar } from "@/components/ui/reaction-bar";
export function PostActions({ post }) {
return (
<ReactionBar
reactions={{ like: { count: post.likes, active: post.liked }, comment: { count: post.comments } }}
onReact={(key, state) => api.react(post.id, key, state.active)}
/>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| reactions | Partial<Record<ReactionKey, { count; active? }>> | Starting count and pressed state per action | |
| onReact | (key, state) => void | Called after a toggle with the new count and state | |
| actions | ReactionKey[] | ["like", "comment", "repost", "share"] | Which actions to show, in order |
| className | string | Extra class on the pill |
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.