How it works
A wrapping row of soft chips (yours tinted with the accent and ringed) plus a round smiley trigger that turns ink while open. The tray is positioned above the row and lined up with its start, so nothing moves and it stays inside: it scales out of the trigger with a spring and its reactions pop in 32ms apart, outward from the one nearest the trigger. Under the pointer a reaction grows to 1.42 and lifts 7px while its neighbours lean 5px aside (transforms only, through :has()). Picking copies the emoji into an absolutely positioned flight that rises 120px along an arc with a little drift and spin and fades out over 900ms, while the tray closes; the chip then pops in, or its count rolls: the old number leaves through a clipped window as the new one arrives.
Use it for
- Light responses to messages, comments, updates and photos, where a reply would be too much.
- Team feeds and threads where people acknowledge, agree or celebrate without adding noise.
- Any list of posts that shows how others responded at a glance.
Look elsewhere when
- Ratings that are averaged or ranked: use rating stars.
- A single like with a count: the like button is simpler.
- Formal approval or votes that need a record of who decided what.
Usage
import { useState } from 'react'
import { ReactionPicker } from './ReactionPicker.jsx'
const reactions = [
{ id: 'up', emoji: '👍', label: 'Thumbs up' },
{ id: 'party', emoji: '🎉', label: 'Celebrate' },
{ id: 'eyes', emoji: '👀', label: 'Looking' },
]
export function MessageReactions({ message }) {
// Your own reaction; counts hold everybody else's
const [mine, setMine] = useState(message.myReaction ?? null)
return (
<ReactionPicker
reactions={reactions}
counts={message.otherReactions} // e.g. { up: 3, party: 2 }
value={mine}
onChange={(id) => {
setMine(id)
saveReaction(message.id, id)
}}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
reactions | { id, emoji, label }[] | six everyday reactions | The reactions in the tray, in order. label names each one for screen readers and tooltips. |
counts | Record<id, number> | {} | How many other people chose each reaction. A chip shows counts[id], plus one when it is yours; reactions at zero have no chip. |
value / defaultValue / onChange | string | null / string | null / (id | null) => void | - / null / - | Your own reaction (one per person), controlled or not. Picking it again, or pressing its chip, sets null. |
launch | boolean | true | Launch a copy of the picked reaction up and away along an arc. |
align | 'start' | 'end' | 'start' | Which end of the row the tray lines up with, so it stays inside the row; use end when the row sits at the right edge. |
labels | object | — | Replaces built-in text: add (trigger name), tray (menu name), chip(label, count, mine). Shallow-merged over the English defaults. |
...rest | HTMLAttributes | — | Other attributes go to the root <div>. |
Accessibility
- The trigger is a <button> with aria-haspopup, aria-expanded and aria-controls; the tray is a menu of menuitemradio buttons with aria-checked on yours.
- Arrow keys, Home and End move through the tray with a roving tabindex, Enter or Space picks, Escape closes and returns focus to the trigger; opening from the keyboard focuses the current reaction.
- Each chip is a toggle button (aria-pressed) whose name says the reaction, its count and whether it includes you.
- Emoji are hidden from screen readers; the label of each reaction is read instead, and shown as a tooltip.
- On touch screens the trigger, chips and reactions grow to 36–44px.
- Reduced motion fades the tray in place and drops the stagger, swell, lean, flight and rolling count.
Motion
Tray: scale 0.5 → 1 with a spring over 360ms from the trigger corner; reactions pop over 420ms, 32ms apart. Swell: 260ms spring. Flight: 900ms, rising 120px with drift and spin, fading out. Chip: pops in over 360ms after 220ms; counts roll over 360ms ease-out. Closing: 160ms ease-in.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
ReactionPicker.jsxreaction-picker.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.





