Victor Mesquita

Reaction Bar

Component 2

About

An accessible row of emoji reaction toggle buttons with live counts and an add-reaction picker menu, for comments, posts, and changelog entries.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Reaction Bar to your project and fits it to your theme.

Code

How Reaction Bar is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import {
  ReactionBar,
  ReactionBarItem,
  ReactionBarPicker,
  ReactionBarPickerOption,
} from "@/components/ui/reaction-bar";
import { useState } from "react";

const reactions = [
  { value: "thumbs-up", emoji: "👍", label: "Thumbs up", count: 12 },
  { value: "heart", emoji: "❤️", label: "Heart", count: 5 },
  { value: "rocket", emoji: "🚀", label: "Rocket", count: 3 },
  { value: "eyes", emoji: "👀", label: "Eyes", count: 0 },
  { value: "party", emoji: "🎉", label: "Party", count: 0 },
];

export default function ReactionBarDemo() {
  const [selected, setSelected] = useState(["heart"]);
  return (
    <div className="flex w-full items-center justify-center p-8">
      <ReactionBar
        variant="pill"
        aria-label="Reactions to this release note"
        value={selected}
        onValueChange={setSelected}
      >
        {reactions.map((reaction) => {
          const count =
            reaction.count + (selected.includes(reaction.value) ? 1 : 0);
          if (count === 0) return null;
          return (
            <ReactionBarItem
              key={reaction.value}
              value={reaction.value}
              emoji={reaction.emoji}
              label={reaction.label}
              count={count}
            />
          );
        })}
        <ReactionBarPicker>
          {reactions.map((reaction) => (
            <ReactionBarPickerOption
              key={reaction.value}
              value={reaction.value}
              emoji={reaction.emoji}
              label={reaction.label}
            />
          ))}
        </ReactionBarPicker>
      </ReactionBar>
    </div>
  );
}

Dependencies

More by Victor Mesquita

View all
  • Data Table Toolbar

    Data Table Toolbar

    10
  • Task List

    Task List

    5
  • Uai Blocks Community Feed

    Uai Blocks Community Feed

    5
  • Comment

    Comment

  • Metric Card

    Metric Card

  • Status Banner

    Status Banner

  • Sign-up Card

    Sign-up Card

  • Password Recovery

    Password Recovery