Emoji Picker

A searchable emoji picker, assembled from parts: one scrolling list of every category with sticky headers — virtualised — through which the arrow keys move from the search field, skin tones, the emojis' names in 28 languages, and the emojis the system can't draw left out. Modelled on Frimousse; the data is Emojibase's (below), bundled with your app.

MediaExperimental

Installation

It has its own entry point, @semantic-components/ui/emoji-picker, built on emojibase-data — an optional peer of ui: install it where you use the component.

ts
import { ScEmojiPicker, ScEmojiPickerSearch, ScEmojiPickerViewport, ScEmojiPickerList } from '@semantic-components/ui/emoji-picker';

Usage

Emoji picker

Select an emoji…

import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScSpinner } from '@semantic-components/ui';import {  type ScEmoji,  ScEmojiPicker,  ScEmojiPickerAnnouncer,  ScEmojiPickerEmpty,  ScEmojiPickerError,  ScEmojiPickerFooter,  ScEmojiPickerList,

Anatomy

The picker holds the data, the search and the active emoji; the list draws the emojis — only the rows in view — under their categories. The rest is yours: the search field's icon, the states' text, a footer with a preview and a skin tone, a category toolbar — parts on your elements.

import {  ScEmojiPicker, ScEmojiPickerSearchField, ScEmojiPickerSearch,  ScEmojiPickerViewport, ScEmojiPickerLoading, ScEmojiPickerEmpty,  ScEmojiPickerError, ScEmojiPickerAnnouncer, ScEmojiPickerList,  ScEmojiPickerFooter, ScEmojiPickerPreview, ScEmojiPickerSkinTone,} from '@semantic-components/ui/emoji-picker';
<div scEmojiPicker>  <div scEmojiPickerSearchField>    <input scEmojiPickerSearch aria-label="…" />  </div>  <div scEmojiPickerViewport>    <span scEmojiPickerLoading>…</span>    <span scEmojiPickerEmpty>…</span>    <span scEmojiPickerError>…</span>    <span scEmojiPickerAnnouncer></span>    <div scEmojiPickerList aria-label="…"></div>  </div>  <div scEmojiPickerFooter>    <div scEmojiPickerPreview>…</div>    <button scEmojiPickerSkinTone>…</button>  </div></div>

Data

  • Emojibase's emojis and their names, in the locale (LOCALE_ID: the app's, or one provided for a section): 28 languages; English for the others.
  • Bundled with your app: each locale is a chunk of its own, downloaded the first time a picker shows it — nothing fetched from a CDN, nothing to host, and the emojis your app was built and tested with. A new Emojibase comes with an upgrade of emojibase-data.
  • The emojis newer than the system draws are left out — they'd show as boxes — and so are flags where the system has none (Windows). emojiVersion sets the newest version yourself.
  • Your own emojis instead: data (an ScEmojiData); loadEmojiData(locale) gives Emojibase's, outside a picker.

Keyboard

  • Typing in the search field filters by name, then by keywords; the first result becomes active.
  • ←→↑↓ move the active emoji across rows and categories — from the search field, where focus stays, or from the list; Enter picks it. Right to left, ← moves on.
  • The category toolbar is one Tab stop; the arrow keys move between its buttons.

Accessibility

  • The list is a grid of rows and cells, named by the emojis' labels in the locale; it counts every row, so a screen reader knows where it is though only the rows in view are drawn.
  • Focus stays in the search field while the arrows move: the active emoji is selected in the grid and said by scEmojiPickerAnnouncer, a hidden live region.
  • You name what has no text: the search field, the list, the category toolbar, the skin-tone button and the loading spinner. Category buttons are named by their category.

Examples

In a popover, opened by your button: the search field takes focus, and a pick closes it (closeOnPick; false keeps it open for more).

In a popover

import { Component, ViewEncapsulation, signal } from '@angular/core';import {  ScButton,  ScPopover,  ScPopoverPortal,  ScPopoverProvider,  ScPopoverTrigger,  ScSpinner,} from '@semantic-components/ui';import {

A category toolbar with your icons, and the recent emojis first — keep recent (in localStorage, say) to restore them.

Categories and recent emojis

import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScSpinner } from '@semantic-components/ui';import {  type ScEmoji,  ScEmojiPicker,  ScEmojiPickerAnnouncer,  ScEmojiPickerCategoryButton,  ScEmojiPickerCategoryNav,  ScEmojiPickerEmpty,  ScEmojiPickerError,

In another language: the emojis' names and the search follow LOCALE_ID, provided for the section; your text is yours to translate. A skin tone applies to the whole list.

In French, with a skin tone

Choisissez un emoji…
import { Component, LOCALE_ID, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScSpinner } from '@semantic-components/ui';import {  ScEmojiPicker,  ScEmojiPickerAnnouncer,  ScEmojiPickerEmpty,  ScEmojiPickerError,  ScEmojiPickerFooter,  ScEmojiPickerList,  ScEmojiPickerLoading,

Just the list: fewer columns (columns), no search, no footer.

Compact (8 columns, no search)

import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScSpinner } from '@semantic-components/ui';import {  type ScEmoji,  ScEmojiPicker,  ScEmojiPickerError,  ScEmojiPickerList,  ScEmojiPickerLoading,  ScEmojiPickerViewport,} from '@semantic-components/ui/emoji-picker';

Into a message: with insertInto, the emoji goes in at the caret, the form value follows, and focus is back in the field after it.

Insert into a message

Value: —

import { CdkOverlayOrigin } from '@angular/cdk/overlay';import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, form } from '@angular/forms/signals';import {  ScButton,  ScInput,  ScInputGroup,  ScInputGroupAddon,  ScPopover,  ScPopoverPortal,

Reactions: a few quick ones, the rest from the picker. A reaction is a toggle — yours or not — with its count.

Reactions to a message

Maya

The release is out — thanks, everyone!

import { Component, ViewEncapsulation, signal } from '@angular/core';import {  ScButton,  ScFrame,  ScPopover,  ScPopoverPortal,  ScPopoverProvider,  ScPopoverTrigger,  ScSpinner,  ScToggle,

Your own emojis (data): a team's set, with its categories, names and search words. The picker works the same.

Your own emojis

Pick a status or a reaction…

import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame } from '@semantic-components/ui';import {  type ScEmoji,  type ScEmojiData,  type ScEmojiDataEmoji,  ScEmojiPicker,  ScEmojiPickerAnnouncer,  ScEmojiPickerEmpty,  ScEmojiPickerFooter,

Right to left: the rows, the category toolbar and the arrow keys run from the right. Emojibase has no Arabic, so the emojis' names are in English.

RTL

اختر رمزًا تعبيريًا…

import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScSpinner } from '@semantic-components/ui';import {  type ScEmoji,  ScEmojiPicker,  ScEmojiPickerAnnouncer,  ScEmojiPickerCategoryButton,  ScEmojiPickerCategoryNav,  ScEmojiPickerEmpty,

API reference

Each part takes class, merged over its look (cn: a later class wins). The skin-tone button is the style's button and the category buttons its toggle: pick another look with variant and size.

InputTypeDefaultDescription
columnsnumber10 Emojis per row.
skinToneScEmojiSkinTone'none' Two-way: the tone emojis are shown in ('light', 'medium-light', 'medium', 'medium-dark', 'dark').
emojiVersionnumber | nullnull The newest Emoji version shown; by default the newest the system draws.
dataScEmojiData | nullnull Your emojis instead of Emojibase's.
stickybooleantrue Category headers stick while their emojis scroll.
recentScEmoji[][] Two-way: the recently picked emojis, latest first — keep them to restore them.
maxRecentnumber20 How many recent emojis are kept.
recentLabelstring | nullnull The name of a first category of the recent emojis; none without it.
closeOnPickbooleantrue In a popover, a pick closes it; false: it stays open for more.
insertIntoHTMLInputElement | HTMLTextAreaElement | nullnull Your text field: a pick goes in at its caret, its value follows (an input event), focus is back in it.
(emojiSelect)ScEmoji— An emoji was picked: { emoji, label }.
PartSelectorDescription
ScEmojiPickerdiv[scEmojiPicker] The picker (#picker="scEmojiPicker"): categories() for a toolbar, skinToneNames(), activeEmoji(), loading(), failed(), empty(), search(); focus(), scrollToCategory(i), nextSkinTone().
ScEmojiPickerSearchFielddiv[scEmojiPickerSearchField] The search row: your icon, then the field.
ScEmojiPickerSearchinput[scEmojiPickerSearch] Filters as you type (names, then keywords); the first result becomes active. Name it.
ScEmojiPickerViewportdiv[scEmojiPickerViewport] The scrolling frame; focusable, so the arrows work from it too.
ScEmojiPickerListdiv[scEmojiPickerList] The grid: draws the emojis — only the rows in view — under their categories, whose headers stick. Name it.
PartSelectorDescription
ScEmojiPickerLoading[scEmojiPickerLoading] Shown while the data loads.
ScEmojiPickerEmpty[scEmojiPickerEmpty] Shown when nothing matches (#empty="scEmojiPickerEmpty": search() for your text).
ScEmojiPickerError[scEmojiPickerError] Shown (an alert) when the data couldn't be loaded.
ScEmojiPickerAnnouncer[scEmojiPickerAnnouncer] A hidden live region: says the emoji moved to with the keyboard.
PartSelectorDescription
ScEmojiPickerFooterdiv[scEmojiPickerFooter] A row under the list, as wide as it.
ScEmojiPickerPreviewdiv[scEmojiPickerPreview] The emoji hovered or moved to and its name; your text (Select an emoji…) while there's none.
ScEmojiPickerSkinTonebutton[scEmojiPickerSkinTone] Cycles the skin tone; write variation() — ✋, or your emoji (scEmojiPickerSkinTone="👍"), in the tone. Name it.
ScEmojiPickerCategoryNavdiv[scEmojiPickerCategoryNav] A toolbar of category buttons: one Tab stop, the arrow keys. Name it.
ScEmojiPickerCategoryButtonbutton[scEmojiPickerCategoryButton]="category" Scrolls to the category (picker.categories()), pressed while it is at the top, named by it. Write its icon (category.key).