Skip to main content

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: user and group are 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

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):

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:

Custom item layout

Combine leadingView, titleView, and subtitleView to fully replace the header’s item area.

titleView

subtitleView

leadingView

Compound Composition

For full layout control, use sub-components. Omit any sub-component to hide it:
Available sub-components:

CSS Styling

Override design tokens on the component selector:

Props

All props are optional (but you need either user or group for the component to display anything).
View slot props (leadingView, titleView, subtitleView, trailingView, auxiliaryButtonView) 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 with group.

group

The group to display in the header. Use for group conversations. Mutually exclusive with user.

hideUserStatus

Hide the online/offline status indicator in the subtitle.

hideBackButton

Hide the back navigation button. Useful on desktop layouts where back navigation is unnecessary.

showSearchOption

Whether to show the search button in the header toolbar.

showConversationSummaryButton

Whether to show the AI conversation summary button.

enableAutoSummaryGeneration

Auto-trigger conversation summary when unread message count >= 15. Requires showConversationSummaryButton to be true and onSummaryClick to be provided.

summaryGenerationMessageCount

Number of last messages to include in the summary request. Passed to the onSummaryClick callback via context.

hideVoiceCallButton

Hide the voice call button.

hideVideoCallButton

Hide the video call button.

callSettingsBuilder

Custom call settings builder for ongoing call sessions. Passed to the OngoingCall component when a call is started. Falls back to GlobalConfig.callSettingsBuilder, then the built-in default.

lastActiveAtDateTimeFormat

Custom date/time format for the “last active” timestamp shown in the subtitle when the user is offline.

onBack

Callback when the back button is clicked.

onItemClick

Callback when the header item (avatar/name area) is clicked. Typically used to open a details panel.

onSearchOptionClicked

Callback when the search button is clicked.

onSummaryClick

Callback when the AI conversation summary button is clicked.

onVoiceCallClick

Callback when the voice call button is clicked. When provided, overrides the default call initiation behavior.

onVideoCallClick

Callback when the video call button is clicked. When provided, overrides the default call initiation behavior.

onError

Callback when an SDK error occurs during call operations or other internal processes.

CSS Selectors


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