Components
Emoji Toolbar Dropdown

Emoji Toolbar Dropdown

Display an emoji selection menu within a toolbar interface.

🙂 Emoji's

Express yourself with a touch of fun 🎉 and emotion 😃.
Pick from the toolbar or write after the colon to open the combobox :

Installation

npx @udecode/plate-ui@latest add emoji-toolbar-dropdown

Examples

import React from 'react';
import {
  EmojiDropdownMenuOptions,
  useEmojiDropdownMenuState,
} from '@udecode/plate-emoji';
 
import { Icons } from '@/components/icons';
import { EmojiToolbarDropdown } from '@/components/plate-ui/emoji-toolbar-dropdown';
import {
  ToolbarButton,
  ToolbarButtonProps,
} from '@/components/plate-ui/toolbar';
 
import { emojiCategoryIcons, emojiSearchIcons } from './emoji-icons';
import { EmojiPicker } from './emoji-picker';
 
type EmojiDropdownMenuProps = {
  options?: EmojiDropdownMenuOptions;
} & ToolbarButtonProps;
 
export function EmojiDropdownMenu({
  options,
  ...props
}: EmojiDropdownMenuProps) {
  const { isOpen, setIsOpen, emojiPickerState } =
    useEmojiDropdownMenuState(options);
 
  return (
    <EmojiToolbarDropdown
      control={
        <ToolbarButton pressed={isOpen} isDropdown tooltip="Emoji" {...props}>
          <Icons.emoji />
        </ToolbarButton>
      }
      isOpen={isOpen}
      setIsOpen={setIsOpen}
    >
      <EmojiPicker
        {...emojiPickerState}
        isOpen={isOpen}
        setIsOpen={setIsOpen}
        icons={{
          categories: emojiCategoryIcons,
          search: emojiSearchIcons,
        }}
        settings={options?.settings}
      />
    </EmojiToolbarDropdown>
  );
}