Skip to content

Emoji picker

Pro

A panel for choosing emoji, with search, a tab per category, recently used emoji and a skin tone; plus its trigger, which inserts at the caret of a message field and opens in a popover, a bottom sheet or docked in the keyboard’s place on phones; and createEmojiSuggestions, which suggests emoji after : in a message field. Not an M3 component (@windmorph/react-pro/emoji-picker, with emojibase-data).

import { EmojiPicker, EmojiPickerTrigger, useEmojiPickerStorage } from '@windmorph/react-pro/emoji-picker';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Keyboard

Emoji picker keyboard
KeyAction
Enter or SpaceOpens the picker; while it is docked below the field (on a phone), closes it and puts the caret back in the text; docked above the field, closes it.On the trigger
Tab or Shift + TabMoves between the search box, the category tabs, the grid (one stop) and the skin-tone button.In the picker
Arrow DownMoves from the search box to the first emoji.In the search box
EscapeClears the search box when it holds text; otherwise closes the picker and returns focus to the trigger.In the picker
EscapeCloses the picker’s popover open beside the field, before the field’s own Escape.In the message field’s text
Arrow Left or Arrow RightMoves between category tabs; Enter or Space on the selected tab scrolls the grid back to its start.On the tabs
Arrow Left or Arrow Right or Arrow Up or Arrow DownMoves by emoji and by row, across categories.In the grid
Home or EndMoves to the first or last emoji of the row.In the grid
Ctrl + Home or Ctrl + EndMoves to the first or last emoji.In the grid
Page Up or Page DownMoves by a screenful of rows.In the grid
Enter or SpaceInserts the emoji (in the chosen skin tone) and keeps the picker open for more.In the grid
  • Arrow keys in the grid and on the tabs follow the reading direction, so they mirror right to left; emoji themselves are not mirrored.
  • The grid scrolls only as far as the focused emoji needs, never the page, and its number of columns follows the panel’s width, so the keys and the layout always agree.

Screen reader

Role
The trigger is a button. The panel is a group holding a search box, a tablist of categories and one grid, with a rowgroup of gridcell rows per category. In a popover or sheet it sits in a dialog; the popover beside a message field is a non-modal one.
Accessible name
The trigger, its dialog and the panel are named by labels.title ("Emoji"), or by the trigger’s aria-label / aria-labelledby, which name its popover and sheet too; the trigger docked below the field by labels.keyboard ("Show keyboard") and docked above it by labels.hide ("Hide emoji"). Each category’s rows are named by its heading, and each emoji by its name in the data’s language, with its tone ("waving hand: medium skin tone").
States announced
The trigger is aria-expanded while the picker is open, and while docked it aria-controls the panel. The grid is named "Search results" while searching and is aria-busy while the emoji load; the selected category tab is aria-selected; the skin-tone button names the tone chosen ("Skin tone, Medium").
  • One polite live region, mounted before its content, announces the result count after a pause in typing, the loading and the load error, and the category focus moves into, since a row group’s name isn’t read as focus enters it.
  • The preview of the focused emoji and the category headings are hidden from assistive tech: each cell’s own name is what’s read.
  • A custom emoji’s image is alt=""; its cell carries its label.

Focus

  • With a fine pointer the trigger opens with focus in the search box, docked too; with a coarse one (a phone, a tablet) on the panel itself, so an on-screen keyboard doesn’t cover it, unless initialFocus is search. initialFocus chooses on a panel of your own (none by default).
  • Inside a message field, focusOnSelect (auto by default) puts a mouse or pen pick back in the text, the caret after the emoji, keeps a keyboard pick on the emoji picked and leaves a touch where it was; elsewhere, and in the sheet, focus stays in the picker between picks. It goes back to the trigger with preventScroll when the picker closes; the keyboard button of the panel docked below the field puts it back in the text instead.
  • Focus is never dropped: an emoji that disappears with a search hands focus to the search box, and Try again holds it on the panel until the data is in.
  • While the sheet is open, the message field behind it is inert, yet picks still go in at its kept caret. The popover beside a field is non-modal and the docked panel leaves the page as it is: the field stays usable, and the popover follows its trigger in Tab order. A popover away from a field is modal.
  • The emoji, the tabs and the panel show the M3 focus indicator on :focus-visible; in forced colours the focus and hover rings are Highlight outlines.

Touch target

  • Each emoji is a 48 × 48px cell, as is the trigger’s icon button.
  • The category tabs share the panel’s width: eight by default (51px each in the 408px panel, M3’s 48px), and up to ten with Recently used (after a pick) and Custom (with custom): about 40px each in the 408px panel and 33px on a 360px phone at worst, above WCAG 2.5.8’s 24px.

Motion

  • Under reduced motion a chosen category scrolls into place at once instead of smoothly, and the popover and sheet keep only their fades.
  • Docked below the field, the panel takes the keyboard's place with no slide, and with no keyboard up it rises from the field's edge without overshooting (the effects easing), so its height never bounces; docked above, it opens as the field's own rows do. Under reduced motion, both change their height at once and only fade.
  • An animatedSrc custom emoji plays only while hovered or focused and in the preview, and never under reduced motion, so the grid stays still (WCAG 2.2.2).

What you need to do

  • Install emojibase-data and emojibase beside Pro, and pass a locale with every loadData, so two languages never share a cache.
  • Translate the picker’s words with labels, or once for the app with a LabelsProvider under EmojiPicker, and load the emoji data in the same language, so names, search and words agree.
  • Give each custom emoji a label that says what it shows: it is the cell’s name, the preview’s text and what search matches.
  • Where you show a custom emoji’s text (:id:), draw its image with the label as its text alternative.
  • An app with accounts passes a storageKey per account (or a controlled recent), since everyone using the browser shares the default key; give createEmojiSuggestions the same one, so suggestions and the picker share Recently used.
  • With emojiSuggestions on a message field, the suggestion list's roles, keys and announcements are the field's (see Message field); translate its emojiSuggestions, emojiLoading and emojiResults words there, in the data's language.