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
Overview
CometChatMessageHeader is a toolbar component that sits at the top of the message panel. It displays the avatar, name, online status (for users), member count (for groups), typing indicator, and call buttons for the active conversation. Wire it with CometChatMessageList and CometChatMessageComposer to build a complete messaging experience.

Live Preview — interact with the default message header.Open in Storybook ↗
The component handles:
- Displaying user avatar and name
- Online/offline presence status (for 1-on-1 conversations)
- Group member count (for group conversations)
- Real-time typing indicators
- Voice and video call buttons with call state management
- Back navigation for mobile layouts
- AI conversation summary trigger
- Search option for in-conversation search
Note:userandgroupare mutually exclusive. Pass one or the other — not both. The component requires at least one to display anything.
Usage
Flat API (User Conversation)
Flat API (Group Conversation)
Compound Composition
Full Layout Example
Actions and Events
Callback Props
| Prop | Signature | Fires when |
|---|---|---|
onBack | () => void | User clicks the back button |
onItemClick | (entity: CometChat.User | CometChat.Group) => void | User clicks the avatar/name area |
onSearchOptionClicked | () => void | User clicks the search button |
onSummaryClick | () => void | User clicks the AI summary button |
onVoiceCallClick | (entity: CometChat.User | CometChat.Group) => void | User clicks the voice call button |
onVideoCallClick | (entity: CometChat.User | CometChat.Group) => void | User clicks the video call button |
onError | ((error: CometChat.CometChatException) => void) | null | SDK error occurs |
Events Emitted
This component does not emit any UI events directly. Call initiation publishes call events internally via the SDK.Events Received
UI events this component subscribes to (published by other components):| Event | Payload | Behavior |
|---|---|---|
ui:call/rejected | { call } | Re-enables call buttons after incoming call rejection |
ui:call/ended | {} | Resets all call state (re-enables buttons, hides call screens) |
ui:call/join | { sessionId, isAudioOnly, group } | Starts a direct call (user clicked Join on meeting bubble) |
ui:active-chat/changed | { unreadCount, ... } | Auto-triggers summary when unread >= 15 (if enabled) |
ui:group/member-added | { group, members, messages } | Updates group member count |
ui:group/member-kicked | { group, user, message } | Updates group member count |
ui:group/member-banned | { group, user, message } | Updates group member count |
ui:group/left | { group } | Updates group member count |
ui:group/member-joined | { joinedGroup } | Updates group member count |
ui:group/ownership-changed | { group } | Updates group member count |
ui:group/member-scope-changed | { group, user, newScope } | Updates group member count |
SDK Listeners (Automatic)
These SDK listeners are attached internally. The component updates its state automatically — no manual subscription needed:- Presence:
onUserOnline,onUserOffline - Typing:
onTypingStarted,onTypingEnded - Groups:
onGroupMemberJoined,onGroupMemberLeft,onGroupMemberKicked,onGroupMemberBanned,onMemberAddedToGroup - Calls:
onIncomingCallReceived,onOutgoingCallAccepted,onOutgoingCallRejected,onIncomingCallCancelled
Customization
View Props
Use view props to replace sections of the default UI while keeping the component’s behavior intact:| Slot | Type | Replaces |
|---|---|---|
leadingView | ReactNode | Avatar area |
titleView | ReactNode | Display name |
subtitleView | ReactNode | Status / typing indicator |
trailingView | ReactNode | Call buttons + overflow menu |
auxiliaryButtonView | ReactNode | Auxiliary button area |
Compound Composition
For full layout control, use sub-components. Omit any sub-component to hide it:| Sub-component | Description | Props | Flat API equivalent |
|---|---|---|---|
Root | Context provider and container | All Root props + children | — |
BackButton | Back navigation button | className | — |
Avatar | User/group avatar | className | leadingView |
Title | Display name | className | titleView |
Subtitle | Status / typing indicator | className | subtitleView |
CallButtons | Voice and video call buttons | className | — |
SearchButton | Search trigger | onClick, className | — |
SummaryButton | AI summary trigger | onClick, className | — |
OverflowMenu | Additional actions | className | — |
AuxiliaryButtons | Custom auxiliary buttons | children, className | auxiliaryButtonView |
CSS Styling
Override design tokens on the component selector:Props
All props are optional (but you need eitheruser or group for the component to display anything).
View slot props (
headerView, searchView, loadingView, emptyView, errorView, itemView, leadingView, titleView, subtitleView, trailingView) are convenience props available only on the flat API. In compound composition mode, use the corresponding sub-components directly.user
The user to display in the header. Use for 1-on-1 conversations. Mutually exclusive withgroup.
| Type | CometChat.User |
| Default | undefined |
group
The group to display in the header. Use for group conversations. Mutually exclusive withuser.
| Type | CometChat.Group |
| Default | undefined |
hideUserStatus
Hide the online/offline status indicator in the subtitle.| Type | boolean |
| Default | false |
hideBackButton
Hide the back navigation button. Useful on desktop layouts where back navigation is unnecessary.| Type | boolean |
| Default | false |
showSearchOption
Whether to show the search button in the header toolbar.| Type | boolean |
| Default | true |
showConversationSummaryButton
Whether to show the AI conversation summary button.| Type | boolean |
| Default | false |
enableAutoSummaryGeneration
Auto-trigger conversation summary when unread message count >= 15. RequiresshowConversationSummaryButton to be true and onSummaryClick to be provided.
| Type | boolean |
| Default | false |
summaryGenerationMessageCount
Number of last messages to include in the summary request. Passed to theonSummaryClick callback via context.
| Type | number |
| Default | 1000 |
hideVoiceCallButton
Hide the voice call button.| Type | boolean |
| Default | false |
hideVideoCallButton
Hide the video call button.| Type | boolean |
| Default | false |
callSettingsBuilder
Custom call settings builder for ongoing call sessions. Passed to the OngoingCall component when a call is started. Falls back toGlobalConfig.callSettingsBuilder, then the built-in default.
| Type | any |
| Default | GlobalConfig.callSettingsBuilder or built-in default |
lastActiveAtDateTimeFormat
Custom date/time format for the “last active” timestamp shown in the subtitle when the user is offline.| Type | CometChatDateFormatConfig |
| Default | Relative time format |
onBack
Callback when the back button is clicked.| Type | () => void |
| Default | undefined |
onItemClick
Callback when the header item (avatar/name area) is clicked. Typically used to open a details panel.| Type | (entity: CometChat.User | CometChat.Group) => void |
| Default | undefined |
onSearchOptionClicked
Callback when the search button is clicked.| Type | () => void |
| Default | undefined |
onSummaryClick
Callback when the AI conversation summary button is clicked.| Type | () => void |
| Default | undefined |
onVoiceCallClick
Callback when the voice call button is clicked. When provided, overrides the default call initiation behavior.| Type | (entity: CometChat.User | CometChat.Group) => void |
| Default | undefined (uses built-in call initiation) |
onVideoCallClick
Callback when the video call button is clicked. When provided, overrides the default call initiation behavior.| Type | (entity: CometChat.User | CometChat.Group) => void |
| Default | undefined (uses built-in call initiation) |
onError
Callback when an SDK error occurs during call operations or other internal processes.| Type | ((error: CometChat.CometChatException) => void) | null |
| Default | null |
CSS Selectors
| Target | Selector |
|---|---|
| Root container | .cometchat-message-header |
| Back button | .cometchat-message-header__back-button |
| Avatar | .cometchat-message-header__avatar |
| Content area | .cometchat-message-header__content |
| Title | .cometchat-message-header__title |
| Subtitle | .cometchat-message-header__subtitle |
| Trailing area | .cometchat-message-header__trailing |
| Call buttons | .cometchat-message-header__call-buttons |
| Search button | .cometchat-message-header__search-button |
| Summary button | .cometchat-message-header__summary-button |
Next Steps
Message List
Display messages for the active conversation
Message Composer
Compose and send messages
Thread Header
Header for threaded message views
Theming
Customize colors, fonts, and spacing