EmojiPicker

A searchable grid of emoji, grouped by category. It brings no emoji data of its own, so you pass the list you want, from a package such as emojibase or emoji-mart or from a short list of your own.

General

Each category has an id, a label and its emojis. Search matches the name and the keywords.

Choose an emoji

onEmojiSelect receives the emoji and its category. Here it adds the emoji to a text.

APIs

EmojiPicker.Props

AttributeDescriptionTypeAccepted valuesDefault
datathe categories and their emojisEmojiCategory[]EmojiCategory-
onEmojiSelectcalled when an emoji is chosen(emoji: EmojiItem, category: EmojiCategory) => void--
columnsemojis per rownumber-8
emojiSizesize of an emoji, in pixelsnumber-24
heightheight of the list, in pixelsnumber-300
withSearchshow the search fieldboolean-true
searchLabelaccessible name of the search fieldstring-Search emoji
searchPlaceholderplaceholder of the search fieldstring-Search emoji
withCategoryNavshow the bar to jump between categoriesboolean-true
categoriesLabelaccessible name of that barstring-Categories
withPreviewshow the emoji and its name below the listboolean-true
emptyContentwhat to show when the search finds nothingReactNode-No emoji found
autoFocusfocus the search field on mountboolean-false
...native props, passed to the rootHTMLAttributes'aria-label', 'className', ...-

EmojiCategory

type EmojiCategory = {
  id: string
  label: string
  icon?: string // shown in the category bar, the first emoji when missing
  emojis: EmojiItem[]
}

type EmojiItem = {
  emoji: string // the character
  name: string // names the button, and is searched
  keywords?: string[] // searched too
}

Ref

The ref points at the root div.

Accessibility

Each emoji is a button named by its name, and each category is a region named by its label. The grid is one tab stop.

KeyAction
Arrow keysMove between emoji, and across categories on the same column
Home and EndFirst and last emoji
Arrow Down in the searchGo into the grid
Enter in the searchChoose the first result
Edit this page on GitHub