Overview
The Emoji plugin lets users insert emoji by typing a trigger character (default::) followed by a search query. A dropdown with matching emoji appears, and selecting one inserts the Unicode character directly into the text — no special inline nodes, just plain text.
Installation
Basic Usage
Pass the plugin tocreateYooptaEditor (wrapped with withEmoji); do not pass plugins to <YooptaEditor>. Add EmojiDropdown as a child when using theme UI.
Works out of the boxThe Emoji plugin ships with a built-in dataset of ~400 common emoji. No configuration is needed for basic usage — just add the plugin and it works.You can provide a custom
onSearch function to use your own dataset or API. See the Configuration section below.Features
- Works Out of the Box: Ships with ~400 built-in emoji — no configuration required
- Shortcode Trigger: Type
:to open the emoji picker, then search by name - Plain Text Insertion: Inserts Unicode emoji characters — no special nodes in the document
- Autocomplete Dropdown: Searchable dropdown with keyboard navigation
- Custom Search: Optionally provide your own search logic (local data, API, emoji-mart, etc.)
- Keyboard Navigation: Arrow keys, Enter, Escape support
- Debounced Search: Configurable debounce delay (default: 100ms)
- Multiple Triggers: Support multiple trigger characters if needed
Configuration
Zero Config (Built-in Dataset)
The simplest setup — uses the built-in emoji dataset with ~400 common emoji:Custom Search Function
Provide your ownonSearch to use a custom dataset or API:
With emoji-mart Data
Advanced Configuration
Options
Array of trigger configurations. Each trigger defines a character(s) that opens the emoji dropdown.
Simple single trigger character (shorthand for
triggers: [{char}]). Use this for a single
trigger, or use triggers array for multiple triggers.Custom search function called when user types after trigger. If not provided, uses the built-in dataset (~400 common emoji).Signature:Parameters:
query- The search query (without trigger char)trigger- The trigger that opened the dropdown
EmojiItem objectsDebounce delay for search in milliseconds. Since emoji search is often local, the default is lower than mention (100ms vs 300ms).
Minimum query length before triggering search. Defaults to
1 since emoji shortcodes are meaningless at zero length.Called when an emoji is selected.Signature:
Called when dropdown opens.Signature:
Called when dropdown closes.Signature:
Close dropdown when item is selected.
Close dropdown on click outside.
Close dropdown on Escape key.
EmojiItem Type
Each item returned fromonSearch should match:
The Unicode emoji character (e.g.,
'😀', '🎉')Short name without colons (e.g.,
'grinning', 'tada')Additional search keywords (e.g.,
['happy', 'face'])Category name (e.g.,
'Smileys & Emotion', 'Objects')Commands
Using with Themes
When using a theme (e.g.,@yoopta/themes-shadcn), you need to:
- Apply the theme to your plugins
- Add the EmojiDropdown component to your editor
Custom Dropdown
You can create a custom dropdown using theuseEmojiDropdown hook:
Hooks
useEmojiDropdown
Hook for building custom emoji dropdowns:useEmojiState
Read-only hook for tracking emoji picker state:useEmojiTriggerActive
Check if a specific trigger is currently active:How It Works
Unlike the Mention plugin which inserts inline void elements, the Emoji plugin inserts plain Unicode text. When a user types:smile and selects an emoji:
- The trigger
:and querysmileare deleted from the document - The Unicode character
😊is inserted as plain text viaTransforms.insertText - No special nodes or elements are created — the emoji is just a text character
Use Cases
Chat & Messaging
Quick emoji insertion in chat-style editors
Rich Text Editing
Add expression to documents and notes
Comments & Reactions
Emoji in comment systems and feedback forms
Collaborative Docs
Consistent emoji support across team documents
Best Practices
Use the Built-in Dataset or Local Data
Use the Built-in Dataset or Local Data
The plugin ships with ~400 common emoji that work with zero config. For a more comprehensive dataset, use libraries like
@emoji-mart/data and provide a custom onSearch. Emoji search is fast enough to run locally — avoid API calls when possible.Keep Debounce Low
Keep Debounce Low
Since emoji search is usually local, the default 100ms debounce is appropriate. Only increase it if you’re making API calls.
Include Keywords
Include Keywords
Return items with
keywords arrays so users can find emoji by alternate names (e.g., searching “happy” finds 😀 “grinning”).Limit Results
Limit Results
Return a reasonable number of results (e.g., 10-20) to keep the dropdown manageable. Users typically pick from the first few results.
Handle Empty State
Handle Empty State
The theme dropdowns show helpful messages for empty states. If building a custom dropdown, show “Type to search…” when the query is empty and “No emoji found” when there are no matches.
Troubleshooting
Dropdown not opening
Dropdown not opening
Make sure you’ve:
- Wrapped your editor with
withEmoji() - Added the
EmojiDropdowncomponent to your editor (when using themes)
Search not returning results with custom onSearch
Search not returning results with custom onSearch
If you’re using a custom
onSearch function, check that it:- Returns a Promise or array
- Returns objects with
emojiandnameproperties - Actually matches the query
onSearch, the built-in dataset works automatically.Solution:Trigger not activating
Trigger not activating
The trigger only activates after whitespace or at the start of a line. If you’re typing
: immediately after a word (e.g., hello:), it won’t trigger. This is intentional to avoid false positives with URLs and time formats.Solution: Type a space before : — e.g., hello :smile.Emoji not inserting
Emoji not inserting
Ensure the
insertEmoji command has access to the trigger range. If you’re calling it manually, the dropdown must have been opened first (which sets the trigger range).Solution: Use the dropdown UI or selectItem from the useEmojiDropdown hook, which handles insertion automatically.Related Plugins
- Mention Plugin - Similar autocomplete pattern for mentioning users/resources
- Paragraph Plugin - Text blocks that support emoji insertion

