AI Integration Quick Reference
AI Integration Quick Reference
Where It Fits
CometChatGroups is a directory list component. It renders available groups and emits the selected CometChat.Group via onItemClick. Wire it to CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer to build a group chat layout.

Minimal Render
.cometchat-groups
Filtering Groups
Pass aCometChat.GroupsRequestBuilder to groupsRequestBuilder. Pass the builder instance — not the result of .build().
Filter Recipes
Default page size is 30. The component uses infinite scroll — the next page loads as the user scrolls to the bottom.
The
searchRequestBuilder prop accepts a separate GroupsRequestBuilder for filtering when the search bar is active.
Actions and Events
Callback Props
onItemClick
Fires when a group row is tapped. Primary navigation hook — set the active group and render the message view.onSelect
Fires when a group is checked/unchecked in multi-select mode. RequiresselectionMode to be set.
onError
Fires on internal errors (network failure, auth issue, SDK exception).Global UI Events
CometChatGroupEvents emits events subscribable from anywhere in the application. Subscribe in a useEffect and unsubscribe on cleanup.
SDK Events (Real-Time, Automatic)
The component listens to these SDK events internally. No manual attachment needed unless additional side effects are required.In React 18 StrictMode,
useEffect runs twice on mount in development. The component handles listener cleanup internally, but any additional listeners added alongside the component need cleanup in the useEffect return function to avoid duplicate event handling.Custom View Slots
Each slot replaces a section of the default UI. Slots that accept a group parameter receive theCometChat.Group object for that row.
itemView
Replace the entire list item row. Default:

- TypeScript
- CSS
titleView
Replace the name / title text. Group type badge inline example.
- TypeScript
- CSS
subtitleView
Replace the member count subtitle text. Default:

- TypeScript
- CSS
leadingView
Replace the avatar / left section. Joined status badge example.
- TypeScript
- CSS
trailingView
Replace the right section. Join status button example.
- TypeScript
- CSS
headerView
Replace the entire header bar.
- TypeScript
- CSS
options
Replace the context menu / hover actions on each group item.
- TypeScript
- CSS
Common Patterns
Custom empty state with CTA
Hide all chrome — minimal list
Joined groups only
CSS Architecture
The component uses CSS custom properties (design tokens) defined in@cometchat/chat-uikit-react/css-variables.css. The cascade:
- Global tokens (e.g.,
--cometchat-primary-color,--cometchat-background-color-01) are set on the.cometchatroot wrapper. - Component CSS (
.cometchat-groups) consumes these tokens viavar()with fallback values. - Overrides target
.cometchat-groupsdescendant selectors in a global stylesheet.
CometChatGroups exist on the same page, wrap the component in a container and scope selectors:
Key Selectors
Example: Brand-themed groups

Customization Matrix
Props
All props are optional unless noted otherwise.activeGroup
Highlights the specified group in the list.
Must be a reference-equal object from the SDK; a manually constructed object will not match.
emptyView
Custom component displayed when there are no groups.errorView
Custom component displayed when an error occurs.
Hidden when
hideError={true}.
groupsRequestBuilder
Controls which groups load and in what order.
Pass the builder instance, not the result of
.build().
headerView
Custom component rendered as the entire header bar.hideError
Hides the default and custom error views.
Also suppresses
errorView if set.
hideGroupType
Hides the group type icon (public/private/password).hideSearch
Hides the default search bar.itemView
Custom renderer for the entire list item row.leadingView
Custom renderer for the avatar / left section.loadingView
Custom component displayed during the loading state.onError
Callback fired when the component encounters an error.onItemClick
Callback fired when a group row is clicked.onSelect
Callback fired when a group is selected/deselected. RequiresselectionMode to be set.
options
Custom context menu / hover actions for each group item.searchRequestBuilder
Controls filtering when the search bar is active.selectionMode
Enables single or multi-select checkboxes on list items.onSelect to capture selections.
showScrollbar
Shows the scrollbar in the group list.subtitleView
Custom renderer for the member count subtitle text.titleView
Custom renderer for the name / title text.trailingView
Custom renderer for the right section.Events
All events are RxJS
Subject instances. Subscribe with .subscribe(), unsubscribe with the returned subscription’s .unsubscribe().