Package Exports
- emoji-picker-react
- emoji-picker-react/dist/emoji-picker-react.esm.js
- emoji-picker-react/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (emoji-picker-react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Emoji Picker React (v4)
An emoji picker component for React applications.
What to know before using
- This package assumes it runs in the browser. I have taken many steps to prevent it from failing on the server, but still, it is recommended to only render the component on the client.
Installation
npm install emoji-picker-react
Features
- Custom click handler
- Dark mode
- Customizable styles via css variables
- Default skin tone selection
- Skin tone change
- Different emoji sets (Google, Apple, Facebook, Twitter)
- Native Emoji support
Config Props
onEmojiClick
(event: MouseEvent, emoji: EmojiClickData) => void
- Callback function when an emoji is clicked. The callback receives the event and the emoji data. The emoji data is comprised of the following properties:activeSkinTone: SkinTones; unified: string; unifiedWithoutSkinTone: string; emoji: string; names: string[]; getImageUrl: (emojiStyle: EmojiStyle) => string; }
theme
Theme
- The theme of the picker. Can be eitherlight
ordark
. Default islight
. TheTheme
enum can be imported from the package.import { Theme } from 'emoji-picker-react';
emojiStyle
EmojiStyle
- The emoji style to use. Can be eitherapple
,google
,facebook
,twitter
ornative
. Default isapple
. TheEmojiStyle
enum can be imported from the package.import { EmojiStyle } from 'emoji-picker-react';
autoFocusSearch:
boolean
- Whether to focus the search input on mount. Defaults totrue
.defaultSkinTone:
SkinTones
- The default skin tone to use when an emoji is clicked. Defaults toSkinTones.Neutral
. Possible skin tones are:
✋ NEUTRAL = 'neutral'
✋🏻 LIGHT = '1f3fb'
✋🏼 MEDIUM_LIGHT = '1f3fc'
✋🏽 MEDIUM = '1f3fd'
✋🏾 MEDIUM_DARK = '1f3fe'
✋🏿 DARK = '1f3ff'
The skin tones typescript enum can be imported directly from the package:
import { SkinTones } from 'emoji-picker-react';
skinTonesDisabled:
boolean
- Whether to disable the skin tone selection. Defaults tofalse
.showPreview:
boolean
- Whether to show the preview of the selected emoji. Defaults totrue
.searchPlaceholder:
string
- The placeholder text for the search input. Defaults toSearch
.categories: Allows full config over ordering, naming and display of categories. To only sort/omit categories, you can simply pass an array of category names to display:
RECENTLY_USED = 'recently_used',
SMILEYS_PEOPLE = 'smileys_people',
ANIMALS_NATURE = 'animals_nature',
FOOD_DRINK = 'food_drink',
TRAVEL_PLACES = 'travel_places',
ACTIVITIES = 'activities',
OBJECTS = 'objects',
SYMBOLS = 'symbols',
FLAGS = 'flags'
For a more in-depth configuration, you can pass an array with category config:
[{
category: Categories.RECENTLY_USED;
name: "Recently Used";
}, {
category: Categories.SMILEYS_PEOPLE;
name: "Faces...";
}]