Xzero UI
Pro library

Reactions

Acknowledge a post in one tap, with counts that roll.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/reactions
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/reactions

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Reactions } from "@/components/xzero/reactions/reactions";
import { Heart, PartyPopper, ThumbsUp } from "lucide-react";

const options = [
  { id: "like", label: "Like", icon: ThumbsUp },
  { id: "love", label: "Love", icon: Heart },
  { id: "party", label: "Celebrate", icon: PartyPopper },
];

export function CommentReactions() {
  return <Reactions options={options} defaultValue={[{ id: "like", count: 3, reacted: false }]} onValueChange={(_, change) => save(change)} />;
}

API reference

Reactions

A bar of reaction pills with counts and an add button that opens a picker tray.

PropTypeDefaultDescription
options (required)ReactionOption[]–Every reaction the picker offers: { id, label, icon: LucideIcon }.
valueReaction[]–Controlled reactions: { id, count, reacted }. Pills keep this order; a count of zero leaves the bar.
defaultValueReaction[][]Initial reactions when uncontrolled.
onValueChange(next: Reaction[], change: { id: string; reacted: boolean }) => void–Called with the next list and the change that produced it.
labelstring"Reactions"Accessible name for the bar.
classNamestring–Extra class on the root.

Keyboard interactions

KeysAction
Enter / SpaceToggles your reaction on a pill, or opens the picker from the add button.
ArrowLeft / ArrowRight / ArrowUp / ArrowDownMoves between options in the picker, wrapping at the ends.
Home / EndJumps to the first or last option.
EscapeCloses the picker and returns focus to the add button.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in gestures

Guidance for AI tools

Reactions: Acknowledge a post in one tap, with counts that roll. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components