Skip to main content

Overview

CometChatGroups is a list component that renders all available groups in the app. It emits the selected CometChat.Group via onItemClick. Wire it to CometChatMessages or use it as a group picker in flows like “join group” or “group details.”
Live Preview — interact with the default groups list.Open in Storybook ↗
The component handles:
  • Paginated fetching with infinite scroll
  • Real-time membership updates (joins, leaves, kicks, bans)
  • Search filtering
  • Swipe/hover options
  • Selection mode (single/multiple)

Usage

Flat API

Compound Composition

Full Layout Example


Filtering

Pass a CometChat.GroupsRequestBuilder to groupsRequestBuilder to control which groups load. Pass the builder instance — not the result of .build().
The component includes a built-in search bar. When the user types, it fetches matching groups from the server. For custom search behavior, pass a searchRequestBuilder:

Filter Recipes


Actions and Events

Callback Props

Events Emitted

This component does not emit any UI events.

Events Received

UI events this component subscribes to (published by other components):

SDK Listeners (Automatic)

These SDK listeners are attached internally. The component updates its state automatically — no manual subscription needed:
  • Groups: onGroupMemberJoined, onGroupMemberLeft, onGroupMemberKicked, onGroupMemberBanned, onMemberAddedToGroup

Customization

View Props

Use view props to replace sections of the default UI while keeping the component’s behavior intact:

itemView

Replace the entire list item row. Default:
Customized:

titleView

Replace the name / title text. Group type badge inline example.

subtitleView

Replace the member count subtitle text. Default:
Customized:

Compound Composition

For full layout control, use sub-components. Omit any sub-component to hide it:
Available sub-components:

CSS Styling

Override design tokens on the component selector:

Props

All props are optional.
View slot props (headerView, searchView, loadingView, emptyView, errorView, itemView, leadingView, titleView, subtitleView, trailingView) are convenience props available only on the flat API. In compound composition mode, use the corresponding sub-components directly.

groupsRequestBuilder

Custom request builder for fetching groups. Controls pagination, filtering, and sorting.

searchRequestBuilder

Custom request builder used specifically when the user searches. Separate from the main builder.

searchKeyword

Initial search keyword to pre-filter groups on mount.

hideGroupType

Hide the group type indicator (public/private/password-protected) on group items.

hideSearch

Hide the search bar entirely.

showScrollbar

Show the native scrollbar on the group list.

selectionMode

Enable selection mode for single or multi-select operations.

activeGroup

The currently active/highlighted group. The matching item receives an active visual state.

options

Function that returns context menu options for each group item (shown on hover/swipe).

onItemClick

Callback when a group item is clicked.

onSelect

Callback when a group is selected or deselected (only fires in selection mode).

onError

Callback when an SDK error occurs during fetch or real-time operations.

onEmpty

Callback when the group list is empty after the initial fetch completes.

CSS Selectors


Next Steps

Group Members

View and manage members of a group

Conversations

View recent conversations including group chats

Message List

Display messages for the selected group

Theming

Customize colors, fonts, and spacing