Skip to main content

Where It Fits

CometChatMessageHeader is a Component that showcases the User or Group details in the toolbar. It presents a typing indicator and a back navigation button for ease of use.

Minimal Render


Actions and Events

Callback Props

onError

Fires on internal errors (network failure, auth issue, SDK exception).

onBack

Fires when the back button in the app bar is pressed. Requires showBackButton={true}.

onNewChatButtonClick

Fires when the new chat button is pressed (only applies to AI Assistant users). Allows handling starting a new conversation with the AI assistant.

onChatHistoryButtonClick

Fires when the chat history button is pressed (only applies to AI Assistant users). Allows handling opening the AI assistant chat history.

Custom View Slots

Each slot replaces a section of the default UI. Slots that accept parameters receive the user or group object for customization.

TitleView

Custom view for the name / title text.

AuxiliaryButtonView

Custom buttons that replace the default call buttons.

ItemView

Custom view for the entire header layout.

SubtitleView

Custom view for the subtitle / status text.

LeadingView

Custom view for the avatar / left section.

TrailingView

Custom view for the right section next to call buttons.

Options

A function that returns custom menu items to replace the default menu items entirely. This allows you to define your own set of options for the header menu. Use Cases:
  • Create a custom options menu with specific actions for your use case.
  • Add info and search options with custom navigation.
  • Show different menu options based on user type or permissions.
  • Hide menu options for specific user types (like agentic users).

Pinned Messages

CometChatMessageHeader can show a button that opens a conversation’s pinned messages. It is off by default — set showPinnedMessagesButton to render it, and onPinnedMessagesPress to handle the tap.
The component does not navigate for you: it raises the tap and you decide where to go, so the button works with any navigation setup.
Render CometChatPinnedMessages on that screen, scoped to the same user/group. See the Pin & Save Messages guide for the full flow.
Pin must be enabled for your app in the CometChat Dashboard. The UI Kit reads that setting at login, so the button opens a panel that stays empty if the feature is off for your app.

Thread Subscription

When the header is given a parentMessage, it switches to thread mode and renders a bell that subscribes the user to that thread or unsubscribes them. Without parentMessage there is no thread to follow, so no bell renders — a conversation header can never accidentally show a thread control.
The bell manages itself: it reads the current state, flips optimistically on tap, reverts if the server rejects the change, and stays in step with a toggle made from the message action sheet. To hide it on a particular screen, pass threadSubscriptionVisibility={false}:
The same subscribe/unsubscribe action is also offered as a message option on CometChatMessageList, hidden independently with hideThreadSubscriptionOption — an integrator may want one surface and not the other. See the Thread Subscription guide.

Styling

Using Style you can customize the look and feel of the component in your app. Pass a styling object as a prop to the CometChatMessageHeader component.

Visibility Props

options

Custom menu items for the header options menu.

Next Steps

Message List

Display the list of messages in a conversation

Message Composer

Compose and send messages in a chat

Messages

Complete messaging interface with header, list, and composer

Component Styling

Customize the appearance of UI Kit components