Emoji picker
ProA 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
| Key | Action | Where |
|---|---|---|
| Enter or Space | Opens 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 | On the trigger |
| Tab or Shift + Tab | Moves between the search box, the category tabs, the grid (one stop) and the skin-tone button.In the picker | In the picker |
| Arrow Down | Moves from the search box to the first emoji.In the search box | In the search box |
| Escape | Clears the search box when it holds text; otherwise closes the picker and returns focus to the trigger.In the picker | In the picker |
| Escape | Closes the picker’s popover open beside the field, before the field’s own Escape.In the message field’s text | In the message field’s text |
| Arrow Left or Arrow Right | Moves between category tabs; Enter or Space on the selected tab scrolls the grid back to its start.On the tabs | On the tabs |
| Arrow Left or Arrow Right or Arrow Up or Arrow Down | Moves by emoji and by row, across categories.In the grid | In the grid |
| Home or End | Moves to the first or last emoji of the row.In the grid | In the grid |
| Ctrl + Home or Ctrl + End | Moves to the first or last emoji.In the grid | In the grid |
| Page Up or Page Down | Moves by a screenful of rows.In the grid | In the grid |
| Enter or Space | Inserts the emoji (in the chosen skin tone) and keeps the picker open for more.In the grid | 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 agroupholding a search box, atablistof categories and onegrid, with arowgroupofgridcellrows per category. In a popover or sheet it sits in adialog; 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’saria-label/aria-labelledby, which name its popover and sheet too; the trigger docked below the field bylabels.keyboard("Show keyboard") and docked above it bylabels.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-expandedwhile the picker is open, and while docked itaria-controlsthe panel. The grid is named "Search results" while searching and isaria-busywhile the emoji load; the selected category tab isaria-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 itslabel.
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
initialFocusissearch.initialFocuschooses on a panel of your own (noneby default). - Inside a message field,
focusOnSelect(autoby 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 withpreventScrollwhen 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 areHighlightoutlines.
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
animatedSrccustom 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-dataandemojibasebeside Pro, and pass alocalewith everyloadData, so two languages never share a cache. - Translate the picker’s words with
labels, or once for the app with aLabelsProviderunderEmojiPicker, and load the emoji data in the same language, so names, search and words agree. - Give each custom emoji a
labelthat 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 thelabelas its text alternative. - An app with accounts passes a
storageKeyper account (or a controlledrecent), since everyone using the browser shares the default key; givecreateEmojiSuggestionsthe same one, so suggestions and the picker share Recently used. - With
emojiSuggestionson a message field, the suggestion list's roles, keys and announcements are the field's (see Message field); translate itsemojiSuggestions,emojiLoadingandemojiResultswords there, in the data's language.