Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-react-uikit-v7.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
Where It Fits
CometChatEmojiKeyboard is a base component used by the message composer to let users browse and select emojis. It displays categorized emojis in a grid with a search bar and category tabs. It is lazy-loaded via React.lazy() since it is only rendered when the user opens the emoji picker.
Minimal Render
.cometchat-emoji-keyboard
Sub-Components
CometChatEmojiKeyboard is a compound component with six sub-components:
| Sub-component | Purpose |
|---|---|
Root | Container that provides context, manages state, and renders default layout when no children are provided. |
CategoryTabs | Horizontal scrollable tab bar for emoji categories. Follows WAI-ARIA Tabs pattern. |
SearchBar | Search input for filtering emojis. Wraps CometChatSearchBar. |
EmojiGrid | Grid of emoji buttons with arrow key navigation. Uses role="grid". |
CategorySection | A category title + emoji grid pair. |
EmptyState | Shown when search yields no results. Uses aria-live="polite". |
Root
The outermost wrapper. Manages emoji data, search state, and active category. When nochildren are provided, it renders the default layout (SearchBar + CategoryTabs + category sections + EmptyState).
CategoryTabs
Renders a horizontal scrollable tab bar with one tab per emoji category. Supports mouse wheel horizontal scrolling and full keyboard navigation (ArrowLeft/ArrowRight, Home/End).SearchBar
WrapsCometChatSearchBar and wires it to the emoji keyboard context. Filters emojis by keyword as the user types.
EmojiGrid
Renders emojis in an 8-column grid with full arrow key navigation. Each emoji is a<button> with role="gridcell" and aria-label.
EmptyState
Shown when search yields no results. Usesaria-live="polite" to announce the empty state to screen readers.
Actions and Events
Callback Props
onEmojiClick
Fires when the user clicks or presses Enter on an emoji. Receives the emoji character as a string.onClose
Fires when the user presses Escape (and search is empty). Use this to close the emoji picker popover.Custom View Slots
| Slot | Prop | Signature | Replaces |
|---|---|---|---|
| Custom emoji data | Root.emojiData | CometChatEmojiKeyboardCategoryData[] | Built-in emoji dataset |
| Empty state content | EmptyState.children | ReactNode | Default “No emojis found” text |
Custom emoji data
Provide your own emoji categories and emojis instead of the built-in dataset.- TypeScript
- CSS
Common Patterns
Lazy-loaded emoji picker
Since the emoji keyboard is a heavy component (~1,800 emojis), lazy-load it to keep the initial bundle small.Compound composition
Render only the sub-components you need. For example, show just the search bar and category tabs without the default grid layout.Keyboard Navigation
| Key | Context | Behavior |
|---|---|---|
Tab | Any | Move focus between sections: search → tabs → emoji grid |
Shift+Tab | Any | Move focus backwards between sections |
ArrowLeft / ArrowRight | Category tabs | Navigate between tabs |
Home / End | Category tabs | Jump to first / last tab |
Enter / Space | Category tab | Activate the focused tab and scroll to that category |
ArrowUp / ArrowDown / ArrowLeft / ArrowRight | Emoji grid | Navigate the emoji grid |
Home / End | Emoji grid | Jump to first / last emoji |
Enter / Space | Emoji grid | Select the focused emoji |
Escape | Search input | Clear the search query |
Escape | Any (search empty) | Signal close to parent via onClose |
/ | Any (not in input) | Focus the search input |
CSS Architecture
The component uses CSS custom properties (design tokens) defined in@cometchat/chat-uikit-react/css-variables.css. The cascade:
- Global tokens set on the
.cometchatroot wrapper. - Component CSS (
.cometchat-emoji-keyboard) consumes these tokens viavar(). - Overrides target
.cometchat-emoji-keyboarddescendant selectors.
Key Selectors
| Target | Selector |
|---|---|
| Root | .cometchat-emoji-keyboard |
| Search wrapper | .cometchat-emoji-keyboard__search |
| Category tabs | .cometchat-emoji-keyboard__tabs |
| Single tab | .cometchat-emoji-keyboard__tab |
| Active tab | .cometchat-emoji-keyboard__tab--active |
| Tab icon | .cometchat-emoji-keyboard__tab-icon |
| Emoji list | .cometchat-emoji-keyboard__list |
| Category title | .cometchat-emoji-keyboard__category-title |
| Emoji grid | .cometchat-emoji-keyboard__emoji-grid |
| Emoji item | .cometchat-emoji-keyboard__emoji-item |
| Empty state | .cometchat-emoji-keyboard__empty-state |
Example: Brand-themed emoji keyboard
App.css
Customization Matrix
| What to change | Where | Property/API | Example |
|---|---|---|---|
| Emoji dataset | Component props | emojiData on Root | <Root emojiData={custom}> |
| Handle selection | Component props | onEmojiClick on Root | <Root onEmojiClick={fn}> |
| Handle close | Component props | onClose on Root | <Root onClose={fn}> |
| Search placeholder | Component props | placeholder on SearchBar | <SearchBar placeholder="Find..."> |
| Empty state content | Composition | EmptyState.children | <EmptyState>Custom text</EmptyState> |
| Hide search bar | Composition | Omit SearchBar | Use children without <SearchBar /> |
| Hide category tabs | Composition | Omit CategoryTabs | Use children without <CategoryTabs /> |
| Change dimensions | CSS | --cometchat-emoji-keyboard-width/height | See example above |
| Change visual styling | Global CSS | .cometchat-emoji-keyboard selectors | See example above |
Props
All props are optional unless noted otherwise.CometChatEmojiKeyboard.Root
emojiData
Custom emoji categories. When omitted, the built-in dataset (~1,800 emojis across 8 categories) is used.| Type | CometChatEmojiKeyboardCategoryData[] |
| Default | Built-in emoji dataset |
onEmojiClick
Callback fired when an emoji is selected (click or Enter key).| Type | (emoji: string) => void |
| Default | undefined |
onClose
Callback fired when Escape is pressed and search is empty. Use this to close the picker.| Type | () => void |
| Default | undefined |
className
Custom CSS class appended to the root container.| Type | string |
| Default | undefined |
children
Sub-components to render. When omitted, Root renders the default layout (SearchBar + CategoryTabs + category sections + EmptyState).| Type | ReactNode |
| Default | undefined |
CometChatEmojiKeyboard.CategoryTabs
className
Custom CSS class appended to the tabs container.| Type | string |
| Default | undefined |
CometChatEmojiKeyboard.SearchBar
placeholder
Placeholder text for the search input.| Type | string |
| Default | Localized “Search emoji” |
className
Custom CSS class appended to the search wrapper.| Type | string |
| Default | undefined |
CometChatEmojiKeyboard.EmojiGrid
emojis
Emojis to render in the grid. Required.| Type | Record<string, CometChatEmojiKeyboardEmojiData> |
| Default | — |
className
Custom CSS class appended to the grid container.| Type | string |
| Default | undefined |
CometChatEmojiKeyboard.CategorySection
category
The category to render. Required.| Type | CometChatEmojiKeyboardCategoryData |
| Default | — |
className
Custom CSS class appended to the section container.| Type | string |
| Default | undefined |
CometChatEmojiKeyboard.EmptyState
children
Custom empty state content.| Type | ReactNode |
| Default | "No emojis found" |
className
Custom CSS class appended to the empty state container.| Type | string |
| Default | undefined |
CSS Selectors
| Target | Selector |
|---|---|
| Root | .cometchat-emoji-keyboard |
| Search wrapper | .cometchat-emoji-keyboard__search |
| Category tabs container | .cometchat-emoji-keyboard__tabs |
| Single tab | .cometchat-emoji-keyboard__tab |
| Active tab modifier | .cometchat-emoji-keyboard__tab--active |
| Tab icon (SVG mask) | .cometchat-emoji-keyboard__tab-icon |
| Tab emoji fallback | .cometchat-emoji-keyboard__tab-emoji |
| Emoji list container | .cometchat-emoji-keyboard__list |
| Category section | .cometchat-emoji-keyboard__category-section |
| Category title | .cometchat-emoji-keyboard__category-title |
| Emoji grid | .cometchat-emoji-keyboard__emoji-grid |
| Emoji item | .cometchat-emoji-keyboard__emoji-item |
| Empty state | .cometchat-emoji-keyboard__empty-state |