CometChatMessageHeader is a header bar component that sits at the top of a chat screen, displaying the avatar, name, and status of the user or group in the conversation.

Where It Fits
CometChatMessageHeader sits at the top of a chat screen. Wire it alongside CometChatMessageList and CometChatMessageComposer to build a complete messaging layout.
- Kotlin (XML Views)
- Jetpack Compose
activity_chat.xml
Quick Start
- Kotlin (XML Views)
- Jetpack Compose
Add to your layout XML:Set a
User or Group on the component — this is required for it to display data:CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.
Actions and Events
Callback Methods
onBackPress
Fires when the user presses the back button in the header.
- Kotlin (XML Views)
- Jetpack Compose
onError
Fires on internal errors (network failure, auth issue, SDK exception).
- Kotlin (XML Views)
- Jetpack Compose
SDK Events (Real-Time, Automatic)
The component listens to these SDK events internally. No manual setup needed.Functionality
Custom View Slots
Leading View
Replace the avatar / left section.
- Kotlin (XML Views)
- Jetpack Compose
Subtitle View
Replace the subtitle text below the user’s or group’s name.
- Kotlin (XML Views)
- Jetpack Compose
Trailing View
Replace the right section (action buttons).
- Kotlin (XML Views)
- Jetpack Compose
Item View
Replace the entire default header with a fully customized layout.
- Kotlin (XML Views)
- Jetpack Compose
Style
- Kotlin (XML Views)
- Jetpack Compose
Define a custom style in
themes.xml:themes.xml

ViewModel
- Kotlin (XML Views)
- Jetpack Compose
Next Steps
Message List
Display messages in a conversation
Message Composer
Rich input for sending messages
Component Styling
Detailed styling reference
ViewModel & Data
Custom ViewModels and repositories