Emoji Reaction React component for Tailwind CSS v4
v1.0.1Updated in 1.2.1
A React emoji reaction button in the chat tapback style: it opens a bar of Apple emoji and sends copies of your pick floating up.
Click the button to pop the emoji bar open, or press and drag straight onto an emoji to pick it in one gesture. Hover an emoji to lift it. Pick one and 5 copies stream up off it, drifting apart, shrinking, and blurring out of focus as they climb. Hold the emoji down to keep them coming. The bar flips below the button when there is no room above, and the arrow keys, Home and End move along it. While it is open the button turns into a cross; click that, click outside, or press Escape to close. The button then shows your last pick.
Emoji Reaction is a free React component in the React feedback components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add emoji-reaction, together with UIProvider and the npm packages motion, react-apple-emojis, lucide-react and @radix-ui/react-slot.
Add to a project
Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup
npx wingo-ui@latest add emoji-reactionUsage
Import EmojiReaction from @/components/ui/emoji-reaction.
import { EmojiReaction } from "@/components/ui/emoji-reaction"
export function Demo() {
return <EmojiReaction onReact={(name) => console.log(name)} />
}
// or hang the bar off your own element:
// <EmojiReaction asChild>
// <button className="rounded-2xl bg-card p-4">Nice work</button>
// </EmojiReaction>Props
sizedefault"md""sm" | "md" | "lg"Scale of the button, the bar, and the emoji that fly up. The trigger is 32px (sm), 40px (md) or 48px (lg).
aligndefault"center""left" | "center" | "right"Which edge of the bar lines up with the trigger. It still shifts inward when it would run off screen.
asChilddefaultfalsebooleanUses your own child as the trigger instead of the built-in button, so the bar can hang off a message, card, or image.
surfaceColordefault"auto"stringFill of the trigger, the bar and its tail, any CSS color. Auto is #F4F4F9 on light pages and #262626 on dark ones.
burstCountdefault5numberHow many copies of the emoji fly up per reaction. Holding an emoji repeats the burst, and at most 60 copies are in the air at once.
risedefault450numberHow far the copies climb before they fade out, in pixels. Each copy varies it a little.
holdIntervaldefault550numberWhile an emoji is held down, a new burst fires this often, in milliseconds.
defaultOpendefaultfalsebooleanStarts with the bar open, for a first-run hint or a screenshot. It does not take focus until the user opens it themselves.
openLabeldefault"Add a reaction"stringAccessible name of the trigger before any reaction.
closeLabeldefault"Close reactions"stringAccessible name of the trigger while the bar is open.
reactedLabeldefault"Reacted {emoji}"stringAccessible name of the trigger after a reaction; {emoji} fills in its name.
menuLabeldefault"Pick a reaction"stringAccessible name of the emoji bar.
emojiBaseUrldefault"https://em-content.zobj.net/source/apple/419/"stringWhere the built-in five faces load from; point it at your own mirror of the same file names. Ignored when emojiData is passed.
emojisdefault"["smiling-face-with-hearts", "star-struck", "confused-face", "pleading-face", "grinning-face-with-smiling-eyes"]"string[]Apple emoji names shown in the bar, hyphenated as on Emojipedia. Anything beyond the five defaults needs emojiData too.
emojiDatadefault"built-in Apple emoji set (the five defaults)"EmojiDataEmoji name to image map passed to EmojiProvider. Defaults to the five bundled faces served from the emojipedia CDN; pass react-apple-emojis/src/data.json for the full set.
onReact(name: string) => voidCalled with the emoji name every time one is picked, including each repeat while it is held down.
childrenReactNodeThe custom trigger when asChild is set. Ignored otherwise.
classNamestringExtra classes merged onto the root element; other div props are spread onto it too.
Examples
React to chat messages
asChild turns each message bubble into the trigger; onReact receives the emoji name to show or save.
Under a post
The small size next to a running count; every pick, including held repeats, adds one.
Fewer faces, bigger burst
emojis narrows the bar to three; burstCount and rise send more copies higher.
Files
- components/ui/emoji-reaction.tsx
FAQ
Is the React Emoji Reaction component free?
Yes. The source is free and needs no account: copy it from the Code tab or install it with the CLI.
How do I install Emoji Reaction?
Run npx wingo-ui@latest add emoji-reaction. It also adds the Wingo UI item it builds on (UIProvider) and the npm packages motion, react-apple-emojis, lucide-react and @radix-ui/react-slot. With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/emoji-reaction.json.
See also
More React feedback components
Articles using this component
- React Emoji Picker: Search, Skin Tones and Phone Sheets
Component guides9 min read