Skip to main content
CometChatConversations renders a scrollable list of recent conversations with real-time updates for new messages, typing indicators, read receipts, and user presence.

Where It Fits

CometChatConversations is a list component. It renders recent conversations and emits the selected Conversation via onItemTap. Wire it to CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer to build a standard chat layout.

Quick Start

Using Navigator:
Embedding as a widget:
Prerequisites: CometChat SDK initialized with CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.

Filtering Conversations

Pass a ConversationsRequestBuilder to control what loads:

Filter Recipes


Actions and Events

Callback Methods

onItemTap

Fires when a conversation row is tapped. Primary navigation hook.

onItemLongPress

Fires when a conversation row is long-pressed. By default the row opens a context menu with Pin / Unpin (v6.1.1 and later, when pinConversationOptionVisibility is not false) and Delete (when deleteConversationOptionVisibility is true). Setting this callback replaces that menu.

onBack

Fires when the user presses the back button in the app bar.

onSelection

Fires when conversations are selected/deselected in multi-select mode.

onError

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

onLoad

Fires when the list is successfully fetched and loaded.

onEmpty

Fires when the list is empty after loading.

Global Events

The component emits events via CometChatConversationEvents that can be subscribed to from anywhere:

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.
Conversation.conversationWith is an AppEntity (a User or a Group), so it has no .name. Narrow the type before reading a display name. The snippets below use this helper:

Title View

Replace the name / title text.

Subtitle View

Replace the last message preview.

Trailing View

Replace the timestamp / badge / right section.

List Item View

Replace the entire list item row.

State Views



Pin Conversations

Available since v6.1.1 Long-pressing a row opens a context menu with Pin / Unpin alongside Delete. Pinned rows show a pin icon and form a shelf at the top of the list, ordered system pins first (placed by an admin surface, pinnedBy == "app_system"), then the user’s own pins, then the remaining conversations by latest activity. Real-time events keep that ordering: new activity moves a conversation to the top of its own section only, never above a pin. Everything is wired through the SDK’s Pin A Conversation APIs: the component performs the pin/unpin call, shows a “Conversation pinned” / “Conversation unpinned” toast — or, at the cap, “You can only pin N chats. Unpin one to pin another.” with the server’s limit — and reorders the list from the SDK’s ConversationListener events, including pins made from the user’s other devices. The option is offered on unpinned rows and on rows the logged-in user pinned. It is withheld from rows pinned by anyone else — app_system or another UID — which keep the pin icon but cannot be unpinned from the client. It also hides itself when CometChat.isPinConversationEnabled() returns false. To hide it regardless, set pinConversationOptionVisibility to false.
Passing your own onItemLongPress replaces the built-in context menu, Pin and Delete included. From v6.2.0, setOptions also replaces the built-in Pin and Delete entries with the options you return, while addOptions keeps them and lists your options in front.

Common Patterns

Minimal list — hide all chrome

Users-only conversations

Custom date formatting


Advanced

BLoC Access

Provide a custom ConversationsBloc to override behavior:

Extending ConversationsBloc

ConversationsBloc uses the ListBase<Conversation> mixin with override hooks for custom list behavior:
For ListBase override hooks (onItemAdded, onItemRemoved, onItemUpdated, onListCleared, onListReplaced), see BLoC & Data — ListBase Hooks.

Public BLoC Events

Public BLoC Methods

Route Observer

Pass a RouteObserver to freeze rebuilds when another screen is pushed on top (prevents expensive rebuilds during keyboard animation):

Style

Style Properties

See Component Styling for the full reference.

Next Steps

Users

Browse and search available users

Message List

Display messages for a conversation

Component Styling

Detailed styling reference

Message Template

Customize message bubble structure