This page as markdown: /reaction-picker.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

ReactionPicker

Status: stable

The quick row of emoji you react to a message with: a toolbar of large emoji toggles that bloom in one after another as it opens and magnify under the pointer, with MenuReactions as the same row inside a right-click menu.

Keywords: reaction, reactions, emoji, emoji picker, react, tapback, quick reactions, message actions, chat

Usage

Use ReactionPicker wherever a reader chooses a reaction for something: in a Popover from an add-reaction control (BubbleReactionAdd is that, ready-made), or as a hover bar over a message. Use MenuReactions for the same row as the first group of the menu a message opens on right-click or long-press, above Reply and Copy. Both report which emoji the reader has already used, so choosing one again removes it.

Best practices

Anatomy

Part Required Description
ReactionPicker yes The toolbar: one tab stop, arrow keys move between emoji, each a toggle with aria-pressed.
MenuReactions no The same row as a group of checkbox menu items, for MenuContent and ContextMenuContent. Choosing one closes the menu.

Subcomponents

Name Type Description
MenuReactions { reactions?; selected?; onSelect?; motion? } & ComponentProps The quick row as checkbox menu items, for the first group of a MenuContent or ContextMenuContent. Same props as ReactionPicker, without children.

Props

Name Type Default Description
reactions readonly { emoji: string; label: string }[] DEFAULT_REACTIONS The choices, in order. The default is 👍 ❤️ 😂 🎉 😮 😢 🙏.
selected readonly string[] [] The emoji the reader has already reacted with: shown pressed, and choosing one again removes it.
onSelect (emoji: string) => void — Called with the emoji the reader chose. Toggle it in or out of selected.
children ReactNode — ReactionPicker only: trailing controls after the emoji, such as a button that opens a full emoji picker.
aria-label string "Reactions" The name of the toolbar or menu group.
motion "full" | "subtle" | "off" "full" How much motion this component uses: full (default) inherits the app's policy, subtle keeps the press and drops the wave of emoji blooming in and the magnify, off stills it. It can only turn motion down.

Tokens used

accent, primary, ring

Motion

Accessibility

Related

Examples

In a popover

import { Button, Icon, Popover, PopoverContent, PopoverTrigger, ReactionPicker } from "@sableui/react"

<Popover>
	<PopoverTrigger render={<Button variant="ghost" size="icon-sm" aria-label="Add reaction" />}>
		<Icon name="emoji" />
	</PopoverTrigger>
	<PopoverContent side="top" className="w-auto rounded-full p-1">
		<ReactionPicker selected={mine} onSelect={toggle} />
	</PopoverContent>
</Popover>

In a right-click menu

import { Bubble, ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger, MenuReactions } from "@sableui/react"

<ContextMenu>
	<ContextMenuTrigger render={<Bubble />}>See you at 6.</ContextMenuTrigger>
	<ContextMenuContent>
		<MenuReactions selected={mine} onSelect={toggle} />
		<ContextMenuSeparator />
		<ContextMenuItem>Reply</ContextMenuItem>
		<ContextMenuItem>Copy text</ContextMenuItem>
	</ContextMenuContent>
</ContextMenu>

A custom set

import { ReactionPicker } from "@sableui/react"

<ReactionPicker
	reactions={[
		{ emoji: "✅", label: "Done" },
		{ emoji: "👀", label: "Looking" },
		{ emoji: "🚀", label: "Shipped" },
	]}
	selected={mine}
	onSelect={toggle}
/>