Emoji Picker
A searchable, virtualized emoji picker recipe with recent selections, skin tones, previews, and optional Popover composition.
Emoji Picker provides searchable Unicode emoji selection without making a large locale dataset part of the Zenos core package. It supports keyboard navigation, virtualized category rendering, skin tones, persisted recent selections, and a hovered or keyboard-active preview.
Powered by Frimousse for emoji data resolution, search, keyboard behavior, and virtualization. Zenos owns the semantic styling, recent-selection state, preview, and Popover composition.
pnpm dlx @zentara-co/zenos-cli add emoji-pickerThe command installs frimousse and adds emoji-picker.tsx to the consumer project. Import the editable recipe through the path configured by your application:
import { EmojiPicker } from "./components/emoji-picker";Basic usage
Section titled โBasic usageโEmojiPicker renders the complete search, recent row, virtualized list, skin-tone control, loading and empty states, and active-emoji preview. Handle the selected object when the application needs both the Unicode character and its localized label.
No emoji selected
<EmojiPicker onEmojiSelect={({ emoji, label }) => { setReaction(emoji); announce(`${label} selected`); }}/>EmojiPicker โโโ EmojiPicker.Root โ โโโ EmojiPicker.Search โ โโโ EmojiPicker.SkinToneSelector โ โโโ EmojiPicker.Recents โ โโโ EmojiPicker.Viewport โ โ โโโ EmojiPicker.Loading โ โ โโโ EmojiPicker.Empty โ โ โโโ EmojiPicker.List โ โโโ EmojiPicker.Preview โโโ Optional Popover composition โโโ EmojiPickerPopover โโโ EmojiPickerTrigger โโโ EmojiPickerContent
Popover composition
Section titled โPopover compositionโUse the Popover wrappers for reaction buttons, comment editors, and compact toolbars. The content closes after selection by default. Set closeOnSelect={false} when users should add several emojis without reopening it.
Open the picker to change the reaction.
<EmojiPickerPopover> <EmojiPickerTrigger render={ <IconButton aria-label="Choose reaction"> <SmileyIcon /> </IconButton> } /> <EmojiPickerContent onEmojiSelect={({ emoji }) => setReaction(emoji)} /></EmojiPickerPopover>EmojiPickerContent accepts the same picker props as EmojiPicker, plus align, side, sideOffset, and popoverClassName for placement and surface customization.
Compose a custom layout
Section titled โCompose a custom layoutโEvery visible part is exported. Use the parts when the product needs different ordering, custom loading copy, a compact viewport, or no preview. Keep Search, Viewport, List, and any Frimousse state-aware parts inside EmojiPicker.Root.
<EmojiPicker.Root onEmojiSelect={handleSelect}> <EmojiPicker.Search placeholder="Find a reaction" /> <EmojiPicker.Recents label="Your reactions" /> <EmojiPicker.Viewport className="h-48"> <EmojiPicker.Loading>Loading reactionsโฆ</EmojiPicker.Loading> <EmojiPicker.Empty>{({ search }) => `No match for โ${search}โ.`}</EmojiPicker.Empty> <EmojiPicker.List /> </EmojiPicker.Viewport></EmojiPicker.Root>EmojiPicker.List accepts Frimousseโs components override. Provide any subset of CategoryHeader, Row, and Emoji; Zenos defaults remain in place for omitted renderers.
Recent selections
Section titled โRecent selectionsโUncontrolled recents persist to localStorage under zenos-emoji-picker-recent. The picker de-duplicates the selected emoji, moves it to the start, and retains eight items by default.
- Set
storageKey={null}to disable persistence. - Change
storageKeywhen separate product areas need independent history. - Use
recent,onRecentChange, andrecentLimitwhen application state owns the list. - Use
defaultRecentto seed an uncontrolled picker. - Set
showRecents={false}to hide the row while selection history continues updating.
Persisted recents contain emoji characters only. Do not put user content, identifiers, or private metadata in the storage key.
Emoji data and localization
Section titled โEmoji data and localizationโFrimousse fetches localized Emojibase data on demand by default and caches it. Set locale to a supported locale, or provide resolveEmojiData when the application needs a custom locale, a reduced dataset, deterministic tests, or an offline build.
<EmojiPicker locale="id" emojibaseUrl="https://static.example.com/emojibase-data" onEmojiSelect={handleSelect}/>Self-host the dataset when Content Security Policy or offline requirements disallow the default CDN. Keep the resolver stable between renders; Frimousse reloads when the locale or dataset options change.
Root API
Section titled โRoot APIโ| Prop | Type | Default | Description |
|---|---|---|---|
onEmojiSelect | (emoji: { emoji: string; label: string }) => void | โ | Receives the selected Unicode character and localized label. |
locale | Locale | en | Locale used to resolve labels, tags, categories, and search terms. |
columns | number | 8 | Number of emoji buttons in each virtualized row. |
skinTone | none | light | medium-light | medium | medium-dark | dark | none | Initial skin-tone preference passed to Frimousse. |
recent / defaultRecent | readonly string[] | โ | Controlled or initial recent emoji characters. |
onRecentChange | (recent: readonly string[]) => void | โ | Called after selection reorders the recent list. |
recentLimit | number | 8 | Maximum recent selections retained after de-duplication. |
storageKey | string | null | zenos-emoji-picker-recent | Persistence key, or null to disable localStorage. |
showRecents / showPreview | boolean | true | Toggles the composed picker sections without changing selection behavior. |
resolveEmojiData | EmojiDataResolver | โ | Custom synchronous or asynchronous locale dataset resolver. |
The root forwards native div props and its ref. Visible parts accept className, merge it after their defaults, and expose stable data-slot attributes.
Accessibility
Section titled โAccessibilityโFrimousse owns list navigation and search interaction. Zenos preserves those semantics while adding visible focus states and accessible labels for recent selections.
- Give an icon-only
EmojiPickerTriggeran accessible name describing the action. - Keep emoji labels from the selected object when announcing a selection; the character alone may not be announced consistently.
- Do not remove the focus indicator from emoji buttons or search.
- Keep search before the virtualized list in reading order.
- Test keyboard selection, search results, and Popover dismissal at the productโs supported zoom levels.
- If the picker opens in a chat composer, restore focus to the trigger after it closes.
Review checklist
Section titled โReview checklistโ- The trigger has a meaningful accessible name.
- Selection uses both the emoji character and its localized label where needed.
- The chosen locale or custom resolver is available in production.
- Content Security Policy allows the data URL, or the dataset is self-hosted.
- Search, arrow-key navigation, Enter selection, and Escape dismissal work.
- Recent-history persistence matches the productโs privacy expectations.
- Light, dark, narrow, RTL, loading, empty, and long-label states are verified.