Emoji Reactions, animated React component
A message with reaction chips that pop and roll their counts when tapped, plus a spring picker that adds new reactions with a layout animation. Also includes the Motion Kit Spark Reactions variant.
- Pro
- Inputs & Controls
- Spring
Pops when you pick or add a reaction and plays a quieter off when you remove yours. Sound is off on this site until you switch it on.
Emoji Reactions
Spark Reactions
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| message | React.ReactNode | "Shipped the new onboarding flow" | Text in the message bubble. Pass null to show only the reactions. |
| reactions | { emoji: string; count: number; reacted?: boolean }[] | [🚀 3, 🔥 2] | Starting reactions. |
| emojis | string[] | ["👍", "❤️", "😂", "🎉", "🔥", "🚀", "👀", "🙏"] | Emojis offered in the picker. |
| onChange | (reactions: Reaction[]) => void | — | Called whenever the reaction list changes. |
| accent | string | "#5b8def" | Ring and tint colour for reactions you've added. |
| className | string | — | Extra classes on the wrapper. |
| SparkReactions.message | string | "Shipped the new onboarding flow" | The message the reactions belong to. |
| SparkReactions.reactions | SparkReaction[] | DEFAULT_SPARK_REACTIONS | Starting row, each { id, count, mine } (rocket 3 and fire 2 by default). |
| SparkReactions.options | SparkReactionOption[] | DEFAULT_SPARK_OPTIONS | Reactions in the picker, each { id, label, d, color, darkColor? }; also the icons for reactions. |
| SparkReactions.onChange | (reactions: SparkReaction[]) => void | — | Called with the new row after the user adds or removes a reaction. |
| SparkReactions.autoplay | boolean | false | Reacts, opens the picker and un-reacts on a loop until someone touches it. |
| SparkReactions.className | string | — | Extra classes for the root. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Emoji Reactions is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Emoji Reactions works
Message reactions. Tap a pill to add or remove yours: the count rolls and slides into the row and the others make room.
The source, the install command and the build prompt come with Pro.
Emoji Reactions questions
How do I install Emoji Reactions?
Run `npx shadcn@latest add @nexus-labs/emoji-reactions`. It installs framer-motion and lucide-react, and the same install includes the `SparkReactions` variant. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I set the starting reactions and the picker emojis?
Pass `reactions` as `{ emoji, count, reacted? }[]` for the starting row (default is rocket 3 and fire 2), and `emojis` for the picker options. `message` sets the bubble text, or pass `null` to show only the reactions, and `onChange` receives the updated list.
How do the counts animate when someone reacts?
Each chip pops when you add a reaction and its count rolls digit by digit, built with Framer Motion, with a layout animation when a new chip joins the row. Clicking a chip toggles your own reaction, and `accent` (default `#5b8def`) colors the ring on reactions you added.
Is the picker keyboard accessible?
Yes. The add button opens the picker with Enter, Space or ArrowDown and moves focus to the first emoji, Escape closes it and returns focus to the button, and chips use `aria-pressed` with a label that includes the count. With reduced motion on, the picker fades instead of scaling in and the digits fade instead of rolling.
Does it make sound, and how do I turn it off?
Pops when you pick or add a reaction and plays a quieter off when you remove yours. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.