Skip to main content

Where It Fits

CometChatGroupMembers is a panel component that renders the member list for a specific group. It requires a group prop and provides built-in member management actions (kick, ban, scope change) based on the logged-in user’s role. Typically rendered alongside the message view in a group chat layout.

Minimal Render

Root CSS class: .cometchat-group-members

Filtering Group Members

Pass a CometChat.GroupMembersRequestBuilder to groupMemberRequestBuilder. 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 GroupMembersRequestBuilder for filtering when the search bar is active. Refer to GroupMembersRequestBuilder for the full builder API.

Actions and Events

Callback Props

onItemClick

Fires when a member row is tapped.

onSelect

Fires when a member is checked/unchecked in multi-select mode. Requires selectionMode to be set.

onEmpty

Fires when the member list has no data to display.

onError

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

Global UI Events

CometChatGroupEvents emits events subscribable from anywhere in the application. The component both emits and subscribes to these events. Events emitted by this component: Events subscribed internally:

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 member parameter receive the CometChat.GroupMember object for that row.

itemView

Replace the entire list item row. Default:
Customized:

subtitleView

Replace the subtitle text. Joined date example. Default:
Customized:

trailingView

Replace the right section. Scope tag example. Default:
Customized:

headerView

Replace the entire header bar.

options

Replace the context menu / hover actions on each member item. The options callback receives both the group and the member.

Common Patterns

Hide member management actions

Admins and moderators only

Minimal chrome


CSS Architecture

The component uses CSS custom properties (design tokens) defined in @cometchat/chat-uikit-react/css-variables.css. The cascade:
  1. Global tokens (e.g., --cometchat-primary-color, --cometchat-background-color-01) are set on the .cometchat root wrapper.
  2. Component CSS (.cometchat-group-members) consumes these tokens via var() with fallback values.
  3. Overrides target .cometchat-group-members descendant selectors in a global stylesheet.

Key Selectors

Example: Brand-themed group members

Customization Matrix


Props

All props are optional unless noted otherwise.

disableLoadingState

Skips the loading spinner when re-fetching.

emptyView

Custom component displayed when there are no members.

errorView

Custom component displayed when an error occurs. Hidden when hideError={true}.

group

The group whose members are fetched and displayed. Required.

groupMemberRequestBuilder

Controls which members load and in what order. Pass the builder instance, not the result of .build().

headerView

Custom component rendered as the entire header bar.

hideBanMemberOption

Hides the option to ban a member from the group.

hideError

Hides the default and custom error views.

hideKickMemberOption

Hides the option to kick a member from the group.

hideScopeChangeOption

Hides the option to change the scope of a group member.

hideSearch

Hides the default search bar.

hideUserStatus

Hides the user’s online/offline status indicator.

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.

onEmpty

Callback fired when the member list is empty.

onError

Callback fired when the component encounters an error.

onItemClick

Callback fired when a member row is clicked.

onSelect

Callback fired when a member is selected/deselected. Requires selectionMode to be set.

options

Custom context menu / hover actions for each member item.

searchKeyword

Pre-fills the search and filters the member list.

searchRequestBuilder

Controls filtering when the search bar is active.

selectionMode

Enables single or multi-select checkboxes on list items.

showScrollbar

Shows the scrollbar in the member list.

subtitleView

Custom renderer for the subtitle text.

titleView

Custom renderer for the name / title text.

trailingView

Custom renderer for the right section (scope badge / actions).

Events

All events are RxJS Subject instances. Subscribe with .subscribe(), unsubscribe with the returned subscription’s .unsubscribe().

CSS Selectors