Skip to main content
The CometChatGroups component displays a searchable list of all available groups. It shows group names, avatars, member counts, and group type indicators (public/private/password-protected). Users can browse, join, and interact with group conversations.
CometChatGroups showing a searchable list of groups with avatars, names, member counts, and group type indicators

Where It Fits

CometChatGroups displays all available groups for browsing and joining. It’s typically used as a standalone screen or within a tab view controller.
CometChatGroups showing integration with navigation controller and group selection handling

Minimal Render

CometChatGroups showing minimal render with default configuration displaying group list

Filtering

Use GroupsRequest.GroupsRequestBuilder to filter which groups appear in the list. The builder pattern allows chaining multiple filter conditions.

Filter Recipes


Actions and Events

Callback Props

onItemClick

Fires when a user taps on a group in the list. Use this to open the group chat.

onItemLongClick

Fires when a user long-presses on a group. Use this to show additional options.

onBack

Fires when the back button is pressed.

onSelection

Fires when groups are selected in selection mode.

onSelectedItemProceed

Fires when the user confirms their selection by tapping the proceed/submit button. Use this to handle the final selection action.

onError

Fires when an error occurs while loading groups.

onEmpty

Fires when the group list is empty.

onLoad

Fires when groups are successfully loaded.

Actions Reference

Global UI Events

SDK Events (Real-Time, Automatic)


Custom View Slots

listItemView

Replace the entire group row with a custom design.
CometChatGroups with custom listItemView showing customized group row with avatar, title, member count, and join button
You can create a CustomGroupCell as a custom UIView:

leadingView

Customize the leading view (avatar area) of a group cell.
CometChatGroups with custom leadingView showing customized avatar area with icon and join button
You can create a CustomLeadingView as a custom UIView:

titleView

Customize the title view of a group cell.
CometChatGroups with custom titleView showing group name with public badge indicator
You can create a CustomTitleView as a custom UIView:

subtitleView

Customize the subtitle area below the group name.
CometChatGroups with custom subtitleView showing member count and group description text
You can create a CustomSubtitleView as a custom UIView:

trailingView

Customize the trailing view (right side) of a group cell.
CometChatGroups with custom trailingView showing joined status badge on the right side
You can create a CustomTrailView as a custom UIView:

loadingStateView

Customize the loading state view displayed while data is being fetched.

errorStateView

Customize the error state view displayed when an error occurs.

emptyStateView

Customize the empty state view displayed when no groups are available.

Options

set(options:)

Define custom swipe options for each group. This method allows you to return an array of CometChatGroupOption based on the group object. These options appear when the user swipes on a group cell.

add(options:)

Dynamically add additional swipe options to groups while preserving the default options. This method lets you return additional CometChatGroupOption elements that will be appended to the existing options.

Data Manipulation Methods

showJoiningGroupAlert(for:)

Displays an alert dialog when a user attempts to join a password-protected group. This method shows a prompt for the user to enter the group password.

hideJoiningGroupAlert(completion:)

Dismisses the joining group alert dialog programmatically. Use this when you need to close the alert without user interaction.

Styling

Style Hierarchy

  1. Global styles (CometChatGroups.style) apply to all instances
  2. Instance styles override global for specific instances

Global Level Styling

Instance Level Styling

Key Style Properties

Customization Matrix


Props

All props are optional. Sorted alphabetically.

avatarStyle

Customizes the appearance of avatars in group list items.

groupsRequestBuilder

Custom request builder for filtering groups.

hideBackButton

Hides the back button in the navigation bar.

hideErrorView

Hides the error state view.

hideGroupType

Hides the public/private/password group type icons.

hideLoadingState

Hides the loading state indicator.

hideNavigationBar

Hides the entire navigation bar.

hideSearch

Hides the search bar.

hideSectionHeader

Hides the alphabetical section headers.

searchRequestBuilder

Custom request builder for search functionality.

selectedCellCount

Returns the count of currently selected groups when in selection mode.

selectionLimit

Sets the maximum number of groups that can be selected in selection mode. When the limit is reached, further selections are disabled.

selectionMode

Sets the selection mode for multi-select functionality.

statusIndicatorStyle

Customizes the appearance of group type status indicators.

Events


Common Patterns

Public groups only

Joined groups only

Custom empty state with CTA

Hide all chrome — minimal list

Multi-select groups