AI Agent Component Spec
AI Agent Component Spec
Where It Fits
CometChatMessageHeader is a toolbar component that sits above CometChatMessageList and CometChatMessageComposer. It receives a user or group prop and displays the conversation’s avatar, name, online status, and typing indicator. Call buttons are rendered automatically when the calling extension is enabled.

Minimal Render
.cometchat-message-header
Actions and Events
Callback Props
onBack
Fires when the back button is clicked. RequiresshowBackButton={true}.
onItemClick
Fires when the header list item area (avatar + name) is clicked.onSearchOptionClicked
Fires when the search option is clicked. RequiresshowSearchOption={true}.
onError
Fires on internal errors.SDK Events (Real-Time, Automatic)
The component listens to these SDK events internally. No manual attachment needed.| SDK Listener | Internal behavior |
|---|---|
onUserOnline / onUserOffline | Updates the user’s online/offline status indicator |
onTypingStarted / onTypingEnded | Shows/hides the typing indicator in the subtitle area |
| Group member events | Updates group member count when members join/leave |
In React 18 StrictMode,
useEffect runs twice on mount in development. The component handles listener cleanup internally.Custom View Slots
View slots forCometChatMessageHeader are JSX.Element (not functions) — unlike list components where slots receive a data parameter.
| Slot | Type | Replaces |
|---|---|---|
itemView | JSX.Element | Entire list item (avatar + name + subtitle) |
leadingView | JSX.Element | Avatar / left section |
titleView | JSX.Element | Name / title text |
subtitleView | JSX.Element | Subtitle text (status / typing indicator) |
trailingView | JSX.Element | Right section (call buttons area) |
auxiliaryButtonView | JSX.Element | Auxiliary button area (next to call buttons) |
itemView
Replace the entire list item (avatar + name + subtitle).
- TypeScript
- CSS
titleView
Replace the name / title text.
- TypeScript
- CSS
subtitleView
Replace the subtitle text (status / typing indicator area).
leadingView
Replace the avatar / left section.
- TypeScript
- CSS
trailingView
Replace the right section (call buttons area).
auxiliaryButtonView
Replace the auxiliary button area (next to call buttons).
lastActiveAtDateTimeFormat
Customize the “last seen” timestamp format using aCalendarObject.
If no property is passed in the CalendarObject, the component checks the global configuration first. If also missing there, the component’s default formatting applies.
Common Patterns
Header with back button and search
Hide call buttons
Group header with AI summary
CSS Architecture
The component uses CSS custom properties (design tokens) defined in@cometchat/chat-uikit-react/css-variables.css. The cascade:
- Global tokens are set on the
.cometchatroot wrapper. - Component CSS (
.cometchat-message-header) consumes these tokens viavar()with fallback values. - Overrides target
.cometchat-message-headerdescendant selectors in a global stylesheet.
Key Selectors
| Target | Selector |
|---|---|
| Root | .cometchat-message-header |
| List item | .cometchat-message-header .cometchat-list-item |
| Body title | .cometchat-message-header .cometchat-list-item__body-title |
| Avatar | .cometchat-message-header .cometchat-list-item .cometchat-avatar |
| Leading view | .cometchat-message-header .cometchat-list-item__leading-view |
| Trailing view | .cometchat-message-header .cometchat-list-item__trailing-view |
| Subtitle | .cometchat-message-header__subtitle |
| Subtitle (typing) | .cometchat-message-header__subtitle-typing |
| Back button | .cometchat-message-header__back-button |
| Auxiliary button view | .cometchat-message-header__auxiliary-button-view |
| List item container | .cometchat-message-header__listitem |
| Title container | .cometchat-message-header .cometchat-list-item__title-container |
Example: Brand-themed header

Customization Matrix
| What to change | Where | Property/API | Example |
|---|---|---|---|
| Override behavior on user interaction | Component props | on<Event> callbacks | onBack={() => navigate(-1)} |
| Toggle visibility of UI elements | Component props | hide<Feature> / show<Feature> boolean props | hideVideoCallButton={true} |
| Replace a section of the header | Component props | <slot>View JSX.Element props | titleView={<div>Custom</div>} |
| Change colors, fonts, spacing | Global CSS | Target .cometchat-message-header class | .cometchat-message-header .cometchat-avatar { border-radius: 8px; } |
Accessibility
The component renders a toolbar with interactive elements. The back button, call buttons, and auxiliary buttons are keyboard-focusable and activate on Enter/Space. The avatar includes alt text. The typing indicator updates the subtitle text dynamically — screen readers announce the change via live region behavior.Props
All props are optional unless noted otherwise.auxiliaryButtonView
Custom component for the auxiliary button area.| Type | JSX.Element |
| Default | undefined |
enableAutoSummaryGeneration
Enables automatic conversation summary generation.| Type | boolean |
| Default | false |
group
Displays group details in the header.| Type | CometChat.Group |
| Default | undefined |
user or group, not both.
hideBackButton
Hides the back navigation button. Deprecated — useshowBackButton instead.
| Type | boolean |
| Default | true |
hideUserStatus
Hides the user’s online/offline status indicator.| Type | boolean |
| Default | false |
hideVideoCallButton
Hides the video call button.| Type | boolean |
| Default | false |
hideVoiceCallButton
Hides the voice call button.| Type | boolean |
| Default | false |
itemView
Custom component for the entire list item.| Type | JSX.Element |
| Default | undefined |
lastActiveAtDateTimeFormat
Format for displaying the “last seen” timestamp.| Type | CalendarObject |
| Default | Component default |
leadingView
Custom component for the avatar / left section.| Type | JSX.Element |
| Default | undefined |
onBack
Callback fired when the back button is clicked.| Type | () => void |
| Default | () => {} |
onError
Callback fired when the component encounters an error.| Type | ((error: CometChat.CometChatException) => void) | null |
| Default | undefined |
onItemClick
Callback fired when the header list item is clicked.| Type | () => void |
| Default | () => {} |
onSearchOptionClicked
Callback fired when the search option is clicked.| Type | () => void |
| Default | () => {} |
showBackButton
Shows the back navigation button.| Type | boolean |
| Default | false |
showConversationSummaryButton
Shows the AI conversation summary button.| Type | boolean |
| Default | false |
showSearchOption
Shows the search option in the header.| Type | boolean |
| Default | false |
subtitleView
Custom component for the subtitle text.| Type | JSX.Element |
| Default | undefined |
summaryGenerationMessageCount
Number of messages used for AI summary generation.| Type | number |
| Default | 1000 |
titleView
Custom component for the name / title text.| Type | JSX.Element |
| Default | undefined |
trailingView
Custom component for the right section.| Type | JSX.Element |
| Default | undefined |
user
Displays user details in the header.| Type | CometChat.User |
| Default | undefined |
user or group, not both.
CSS Selectors
| Target | Selector |
|---|---|
| Root | .cometchat-message-header |
| List item | .cometchat-message-header .cometchat-list-item |
| Body title | .cometchat-message-header .cometchat-list-item__body-title |
| Avatar | .cometchat-message-header .cometchat-list-item .cometchat-avatar |
| Leading view | .cometchat-message-header .cometchat-list-item__leading-view |
| Trailing view | .cometchat-message-header .cometchat-list-item__trailing-view |
| Subtitle | .cometchat-message-header__subtitle |
| Subtitle (typing) | .cometchat-message-header__subtitle-typing |
| Back button | .cometchat-message-header__back-button |
| Auxiliary button view | .cometchat-message-header__auxiliary-button-view |
| List item container | .cometchat-message-header__listitem |
| Title container | .cometchat-message-header .cometchat-list-item__title-container |
| Summary button | .cometchat-message-header__conversation-summary-button |
| Search button | .cometchat-message-header__search-button |
| Menu | .cometchat-message-header__menu |