Skip to content
Playground

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-picker

The command installs frimousse and adds emoji-picker.tsx to the consumer project. Import the editable recipe through the path configured by your application:

TSX
import { EmojiPicker } from "./components/emoji-picker";

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.

TSX
<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

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.

TSX
<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.

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.

TSX
<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.

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 storageKey when separate product areas need independent history.
  • Use recent, onRecentChange, and recentLimit when application state owns the list.
  • Use defaultRecent to 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.

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.

TSX
<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.

PropTypeDefaultDescription
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.

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 EmojiPickerTrigger an 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.
  • 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.