Overview
The Groups is a Component, showcasing an accessible list of all available groups. It provides an integral search functionality, allowing you to locate any specific groups swiftly and easily. For each group listed, the group name is displayed by default, in conjunction with the group icon when available. Additionally, it provides a useful feature by displaying the number of members in each group as a subtitle, offering valuable context about group size and activity level.
Components | Description |
---|---|
CometChatList | A reusable container component having title, search box, customisable background and a list view. |
CometChatListItem | A component that renders data obtained from a Group object on a Tile having a title, subtitle, leading and trailing view. |
Usage
Integration
The following code snippet illustrates how you can directly incorporate the Groups component into your Application.Actions
Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.1. onSelect
TheonSelect
action is activated when you select the done icon while in selection mode. This returns the group
object along with the boolean flag selected
to indicate if the group was selected or unselected.
This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
2. onItemClick
TheonItemClick
event is activated when you click on the Group List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
3. onError
This action doesn’t change the behavior of the component but rather listens for any errors that occur in the Groups component.Filters
Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.1. GroupsRequestBuilder
The GroupsRequestBuilder enables you to filter and customize the group list based on available parameters in GroupsRequestBuilder. This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in GroupsRequestBuilderMethods | Type | Description |
---|---|---|
setLimit | number | sets the number groups that can be fetched in a single request, suitable for pagination |
setSearchKeyword | String | used for fetching groups matching the passed string |
joinedOnly | boolean | to fetch only joined groups. |
setTags | Array<String> | used for fetching groups containing the passed tags |
withTags | boolean | used to fetch tags data along with the list of groups |
2. SearchRequestBuilder
The SearchRequestBuilder uses GroupsRequestBuilder enables you to filter and customize the search list based on available parameters in GroupsRequestBuilder. This feature allows you to keep uniformity between the displayed Groups List and searched Group List. ExampleEvents
Events are emitted by aComponent
. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
To handle events supported by Groups you have to add corresponding listeners by using CometChatGroupEvents
The Groups
component does not produce any events directly.
Customization
To fit your app’s design requirements, you can customize the appearance of the Groups component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.Style
Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts. Example
Functionality
These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.Property | Description | Code |
---|---|---|
Hide Search | Hides the default search bar. | hideSearch={true} |
Hide Error | Hides the default and custom error view passed in errorView prop. | hideError={true} |
Hide Group Type | Hides the group type icon. | hideGroupType={true} |
Show Scrollbar | Controls the visibility of the scrollbar in the list. | showScrollbar={true} |
Active Group | The group to highlight in the list. | activeGroup={chatGroup} |
Selection Mode | Selection mode to use for the default trailing view. | selectionMode={SelectionMode.multiple} |
Loading View | A custom view to display during the loading state. | loadingView={<>Custom Loading View</>} |
Empty View | Custom view for the empty state of the component. | emptyView={<>Custom Empty View</>} |
Error View | A custom view to display when an error occurs. | errorView={<>Custom Error View</>} |
Advanced
For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.ItemView
A custom view to render for each group in the fetched list. Shown below is the default chat interface.

TitleView
The customized chat interface is displayed below.
SubtitleView
Custom subtitle view to be rendered for each group in the fetched list. Shown below is the default chat interface.

LeadingView
The customized chat interface is displayed below.
TrailingView
The customized chat interface is displayed below.
Header View
A custom component to render in the top-right corner of the groups list. The customized chat interface is displayed below.
Options
You can set the Custom options to the Groups component. The customized chat interface is displayed below.