CometChatMessageHeader component displays user or group details in the toolbar including avatar, name, status, and typing indicators. It also provides navigation controls and call buttons.

AI Integration Quick Reference
AI Integration Quick Reference
Where It Fits
CometChatMessageHeader displays the recipient’s information at the top of the chat screen. It’s typically used within CometChatMessages alongside CometChatMessageList and CometChatMessageComposer.

Minimal Render

Actions and Events
Callback Props
onBack
Fires when the back button is pressed. Use this for custom navigation handling.onError
Fires when an error occurs.Actions Reference
SDK Events (Real-Time, Automatic)
Custom View Slots
listItemView
Replace the entire header content with a custom view.CustomHeaderView as a custom UIView:
leadingView
Customize the leading view (avatar area) of the header.
CustomLeadingView as a custom UIView:
titleView
Customize the title view of the header.
CustomTitleView as a custom UIView:
subtitleView
Customize the subtitle area (status, typing indicator).trailView
Customize the right side of the header (call buttons, etc.).
CustomTrailView as a custom UIView:
Styling
Style Hierarchy
- Global styles (
CometChatMessageHeader.style) apply to all instances - Instance styles override global for specific instances
Global Level Styling
Instance Level Styling

Key Style Properties
Customization Matrix
Connection Management
Manually control the WebSocket connection for the message header.connect()
Establishes the WebSocket connection for real-time updates. Use this when you need to manually reconnect after disconnecting.disconnect()
Disconnects the WebSocket connection. Use this when you want to temporarily stop receiving real-time updates, such as when the view is not visible.Menu Customization
set(options:)
Sets custom menu options for the message header. These options appear in the header’s menu (typically accessed via a more button or long press).Props
All props are optional. Sorted alphabetically.avatarStyle
Customizes the appearance of the avatar in the message header.dateTimeFormatter
Custom formatter for date/time display in the message header (e.g., “Last seen at…”).disableTyping
Disables typing indicators in the message header.enableThreadSubscription
Enables the subscribe/unsubscribe bell in the header’s trailing area, letting users opt in to notifications for a thread’s replies. The bell also requiresparentMessage — setting this flag alone on a conversation header renders nothing, so turning the feature on globally cannot put a thread control on a non-thread screen.
The bell manages itself: it reads the current state from the SDK, flips optimistically on tap, reverts on failure, toasts in both directions, and stays in step with a toggle made from the message action sheet.
hideBackButton
Hides the back button in the header.hideChatHistoryButton
Hides the AI chat history button in the header.hideNewChatButton
Hides the AI new chat button in the header.hideUserStatus
Hides the user status (online/offline/last active).hideThreadSubscriptionButton
Hides the subscribe/unsubscribe bell while leaving the feature on — for a screen that already draws its own control and would otherwise show two.hideVideoCallButton
Hides the video call button.hideVoiceCallButton
Hides the voice call button.onAiChatHistoryClicked
Callback triggered when the AI chat history button is clicked.onAiNewChatClicked
Callback triggered when the AI new chat button is clicked.parentMessage
The thread’s root message the subscription bell acts on. Setting it puts the header in thread mode; leaving itnil keeps the header in its normal conversation mode with no bell.
statusIndicatorStyle
Customizes the appearance of the online/offline status indicator.typingIndicatorStyle
Customizes the appearance of the typing indicator in the message header subtitle.Events
The MessageHeader component does not emit any global UI events.Date Time Formatter
Customize how timestamps appear in the message header (e.g., “Last seen at…”) using theCometChatDateTimeFormatter.
Global Level Formatting
Instance Level Formatting
Available Formatters
Common Patterns
Hide call buttons
Custom back button action
Custom subtitle with typing indicator
Minimal header
Related Components
- Messages - Parent component containing MessageHeader
- Message List - Display messages in a conversation
- Message Composer - Send messages in a conversation
- Conversations - Navigate back to conversation list