Skip to main content
FieldValue
Packagescom.cometchat:chat-uikit-kotlin (Kotlin XML Views), com.cometchat:chat-uikit-compose (Jetpack Compose)
Required setupCometChatUIKit.init() + CometChatUIKit.login() before rendering any component
Shared corechatuikit-core — ViewModels, repositories, use cases, events (shared by both modules)
CallingRequires separate com.cometchat:calls-sdk-android package

Architecture

The UI Kit is a set of independent components that compose into chat layouts. A typical chat layout uses four core components:
  • CometChatConversations — list of recent conversations
  • CometChatMessageHeader — toolbar with avatar, name, status, typing indicator
  • CometChatMessageList — scrollable message feed with reactions, receipts, threads
  • CometChatMessageComposer — rich input with attachments, mentions, voice notes
Selecting a conversation yields a User or Group object. Pass it to the message components to load the chat. Components communicate via CometChatEvents — a SharedFlow-based event bus. See Events.

Component Catalog

Conversations and Lists

ComponentPurposePage
CometChatConversationsScrollable list of recent conversationsConversations
CometChatUsersScrollable list of usersUsers
CometChatGroupsScrollable list of groupsGroups
CometChatGroupMembersScrollable list of group membersGroup Members

Messages

ComponentPurposePage
CometChatMessageHeaderToolbar with avatar, name, status, typingMessage Header
CometChatMessageListMessage feed with reactions, receipts, threadsMessage List
CometChatMessageComposerRich input with attachments, mentions, voiceMessage Composer
CometChatThreadHeaderParent message bubble and reply countThread Header

Calling

ComponentPurposePage
CometChatCallButtonsVoice and video call buttonsCall Buttons
CometChatIncomingCallIncoming call notificationIncoming Call
CometChatOutgoingCallOutgoing call screenOutgoing Call
CometChatCallLogsCall history listCall Logs

Component API Pattern

All components share a consistent API surface across both modules.

Setting User or Group

messageHeader.setUser(user)
messageList.setUser(user)
messageComposer.setUser(user)

// Or for group chat
messageHeader.setGroup(group)
messageList.setGroup(group)
messageComposer.setGroup(group)

Callbacks

conversations.setOnItemClick { conversation -> /* navigate */ }
conversations.setOnError { exception -> /* handle error */ }
conversations.setOnLoad { list -> /* data loaded */ }

Data Filtering

conversations.setConversationsRequestBuilder(
    ConversationsRequest.ConversationsRequestBuilder().setLimit(20)
)

View Slots

Replace specific regions of a component’s UI. See View Slots.
conversations.setSubtitleView(object : ConversationsViewHolderListener() {
    override fun createView(context: Context, binding: CometchatConversationsListItemsBinding): View {
        return CustomSubtitleView(context)
    }
    override fun bindView(context: Context, createdView: View, conversation: Conversation, ...) {
        (createdView as CustomSubtitleView).bind(conversation)
    }
})

Styles

See Component Styling.
XML theme attributes in themes.xml:
<style name="AppTheme" parent="CometChatTheme.DayNight">
    <item name="cometchatConversationsStyle">@style/CustomConversationsStyle</item>
</style>

Events

Global inter-component communication via CometChatEvents:
// Subscribe to message events
viewModelScope.launch {
    CometChatEvents.messageEvents.collect { event ->
        when (event) {
            is CometChatMessageEvent.MessageSent -> { /* handle */ }
            is CometChatMessageEvent.MessageDeleted -> { /* handle */ }
            else -> {}
        }
    }
}
See Events for the full reference.

Next Steps

Core Features

Chat features included out of the box

Theming

Customize colors, fonts, and styles

Customization

Deep customization via ViewModels, styles, and view slots

Guides

Task-oriented tutorials for common patterns