klyv-ui

Reaction Bar

Cards

About

A row of toggleable emoji reactions with live counts and a small particle burst animation when one is picked.

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

"use client";

import ReactionBar from "@/components/ui/reaction-bar";
import Surface from "@/components/ui/reaction-bar-utils/surface";
import Text from "@/components/ui/reaction-bar-utils/text";
import { useState } from "react";

type ReactionItem = {
  id: string;
  emoji: string;
  label: string;
  count: number;
};

export default function ReactionBarDemo() {
  const [picked, setPicked] = useState<string | null>(null);
  const [reactions, setReactions] = useState<ReactionItem[]>([
    { id: "like", emoji: "👍", label: "Helpful", count: 24 },
    { id: "love", emoji: "🎉", label: "Celebrate", count: 9 },
    { id: "think", emoji: "🤔", label: "Not sure", count: 3 },
    { id: "money", emoji: "💸", label: "Costly", count: 1 },
  ]);

  const change = (id: string | null) => {
    setReactions((previous) =>
      previous.map((reaction) => {
        const was = reaction.id === picked;
        const now = reaction.id === id;
        if (was === now) return reaction;
        return { ...reaction, count: reaction.count + (now ? 1 : -1) };
      }),
    );
    setPicked(id);
  };

  return (
    <div className="flex min-h-screen w-full items-center justify-center bg-surface-sunken p-6">
      <div className="flex w-full max-w-[460px] flex-col gap-3">
        <Surface variant="card" padding="lg" className="gap-2">
          <Text size="heading">September in review is ready</Text>
          <Text size="body" weight="medium" tone="soft" leading="normal">
            Spending is down 8% and your cashback covered two subscriptions
            outright.
          </Text>
          <div className="mt-2">
            <ReactionBar
              label="React to this update"
              reactions={reactions}
              value={picked}
              onChange={change}
            />
          </div>
        </Surface>
        <Text size="caption" tone="faint" role="status" aria-live="polite">
          {picked
            ? `You picked ${reactions.find((r) => r.id === picked)?.label}. Pick it again to take it back.`
            : "Nothing picked."}
        </Text>
      </div>
    </div>
  );
}

More by klyv-ui

View all
  • Gantt Chart

    Gantt Chart

    56
  • Klyv Animated Beam

    Klyv Animated Beam

    47
  • Pareto Chart

    Pareto Chart

    40
  • Shader Canvas

    Shader Canvas

    35
  • Sunburst Chart

    Sunburst Chart

    23
  • Morphing Text

    Morphing Text

    21
  • Gooey Loader

    Gooey Loader

    20
  • Gravity Tags

    Gravity Tags

    17

More in Cards

View all
  • Stats cards with links

    Stats cards with links

    33
  • Course Design Cards

    Course Design Cards

    1.1K
  • Card

    Card

    70
  • Statistics Card 2

    Statistics Card 2

    264
  • Statistics Card 10

    Statistics Card 10

    263
  • Card

    Card

    17
  • Card Studio

    Card Studio

    9
  • The Item one

    The Item one

    3