Skip to main content

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

Root CSS class: .cometchat-message-header

Actions and Events

Callback Props

onBack

Fires when the back button is clicked. Requires showBackButton={true}.

onItemClick

Fires when the header list item area (avatar + name) is clicked.

onSearchOptionClicked

Fires when the search option is clicked. Requires showSearchOption={true}.

onError

Fires on internal errors.

SDK Events (Real-Time, Automatic)

The component listens to these SDK events internally. No manual attachment needed.
In React 18 StrictMode, useEffect runs twice on mount in development. The component handles listener cleanup internally.

Custom View Slots

View slots for CometChatMessageHeader are JSX.Element (not functions) — unlike list components where slots receive a data parameter.

itemView

Replace the entire list item (avatar + name + subtitle).

titleView

Replace the name / title text.

subtitleView

Replace the subtitle text (status / typing indicator area).

leadingView

Replace the avatar / left section.

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 a CalendarObject.
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

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:
  1. Global tokens are set on the .cometchat root wrapper.
  2. Component CSS (.cometchat-message-header) consumes these tokens via var() with fallback values.
  3. Overrides target .cometchat-message-header descendant selectors in a global stylesheet.

Key Selectors

Example: Brand-themed header

Customization Matrix


Props

All props are optional unless noted otherwise.

auxiliaryButtonView

Custom component for the auxiliary button area.

enableAutoSummaryGeneration

Enables automatic conversation summary generation.

group

Displays group details in the header. Pass either user or group, not both.

hideBackButton

Hides the back navigation button. Deprecated — use showBackButton instead.

hideUserStatus

Hides the user’s online/offline status indicator.

hideVideoCallButton

Hides the video call button.

hideVoiceCallButton

Hides the voice call button.

itemView

Custom component for the entire list item.

lastActiveAtDateTimeFormat

Format for displaying the “last seen” timestamp.

leadingView

Custom component for the avatar / left section.

onBack

Callback fired when the back button is clicked.

onError

Callback fired when the component encounters an error.

onItemClick

Callback fired when the header list item is clicked.

onSearchOptionClicked

Callback fired when the search option is clicked.

showBackButton

Shows the back navigation button.

showConversationSummaryButton

Shows the AI conversation summary button.

showSearchOption

Shows the search option in the header.

subtitleView

Custom component for the subtitle text.

summaryGenerationMessageCount

Number of messages used for AI summary generation.

titleView

Custom component for the name / title text.

trailingView

Custom component for the right section.

user

Displays user details in the header. Pass either user or group, not both.

CSS Selectors