Add Custom Emojis and Frequently Used Emojis
masterYou can extend the picker with image-based emojis (similar to Slack) using customSections and pin specific emojis to the top using frequentlyUsedEmojis.
Note on selection values:
- Standard emojis return the emoji character (e.g.,
"👍"). - Custom emojis return the name wrapped in colons (e.g.,
":mic-drop:").
import { EmojiPicker } from '@ferrucc-io/emoji-picker';
import type { CustomEmoji, CustomSection } from '@ferrucc-io/emoji-picker';
const customSections: CustomSection[] = [
{
id: 'custom',
name: 'Custom',
priority: 1, // Lower values appear first (defaults to 999)
emojis: [
{ id: 'mic-drop', name: 'mic-drop', imageUrl: '/custom-emojis/mic-drop.gif' },
{ id: 'shipitparrot', name: 'shipitparrot', imageUrl: '/custom-emojis/shipitparrot.gif' },
],
},
];
const frequentlyUsedEmojis: (string | CustomEmoji)[] = [
'👍',
'❤️',
{ id: 'thisisfine', name: 'thisisfine', imageUrl: '/custom-emojis/thisisfine.gif' },
];
<EmojiPicker
customSections={customSections}
frequentlyUsedEmojis={frequentlyUsedEmojis}
onEmojiSelect={(emoji) => {
console.log(emoji);
}}
>
{/* ... */}
</EmojiPicker>