Overview
CometChatAddMembers is a Component that allows administrators or group owners to add new members to a specific group. It enables administrators or group owners to extend the membership of a group by adding new users to participate in the group’s discussions and activities. By utilising this feature, administrators can manage group membership, and control access to group content. The administrator can select the desired users to be added to the group. This can be done by searching for specific users, selecting from a list of available users. The selected users will receive notifications to join the group.

Usage
Integration
The following code snippet illustrates how you can directly incorporate the Add Members component into your Application.- AddMembersDemo.tsx
- App.tsx
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 a list of all the users that you have selected.
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.
- TypeScript
- JavaScript
AddMembersDemo.tsx
2. onAddMembersButtonClick
TheonAddMembersButtonClick action is triggered when you click the add member button after choosing the users you wish to add in the group. By default, it returns the group GUID and an array of members to be added. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
- TypeScript
- JavaScript
AddMembersDemo.tsx
3. OnBack
OnBack is triggered when you click on the back button of the Add Members component. You can override this action using the following code snippet.
- TypeScript
- JavaScript
AddMembersDemo.tsx
4. onClose
onClose is triggered when you click on the close button of the Add Members component. You can override this action using the following code snippet.
- TypeScript
- JavaScript
AddMembersDemo.tsx
5. onError
This action doesn’t change the behavior of the component but rather listens for any errors that occur in the Add Members component.- TypeScript
- JavaScript
AddMembersDemo.tsx
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. UsersRequestBuilder
The UsersRequestBuilder enables you to filter and customize the users list based on available parameters in UsersRequestBuilder. This feature allows you to create more specific and targeted queries when fetching users. The following are the parameters available in UsersRequestBuilder
Example
In the example below, we are applying a filter to the UserList by setting the limit to eight and sorting the lists by their name.
- TypeScript
- JavaScript
AddMembersDemo.tsx
2. SearchRequestBuilder
The SearchRequestBuilder uses UserRequestBuilder enables you to filter and customize the search list based on available parameters in UserRequestBuilder. This feature allows you to keep uniformity between the displayed UserList and searched UserList. Example- TypeScript
- JavaScript
AddMembersDemo.tsx
Events
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.
Events emitted by the Add Members component is as follows.
- Add Listener
- Remove Listener
Customization
To fit your app’s design requirements, you can customize the appearance of the Add Members component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.Style
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.1. AddMembers Style
You can set theAddMembersStyle to the Add Members Component to customize the styling.

- TypeScript
- JavaScript
AddMembersDemo.tsx
2. Avatar Style
To apply customized styles to theAvatar component in the Add Members Component, you can use the following code snippet. For further insights on Avatar Styles refer
- TypeScript
- JavaScript
AddMembersDemo.tsx
3. LisItem Style
To apply customized styles to theListItemStyle component in the Add Members Component, you can use the following code snippet. For further insights on ListItemStyle Styles refer
- TypeScript
- JavaScript
AddMembersDemo.tsx
4. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Add Members Component, You can use the following code snippet. For further insights on Status Indicator Styles refer- TypeScript
- JavaScript
AddMembersDemo.tsx
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.- TypeScript
- JavaScript
AddMembersDemo.tsx


Advance
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.ListItemView
With this property, you can assign a custom ListItem to the Add Members Component.

- TypeScript
- JavaScript
AddMembersDemo.tsx
SubtitleView
You can customize the subtitle view for each users to meet your requirements

- TypeScript
- JavaScript
AddMembersDemo.tsx
LoadingStateView
You can set a custom loader view usingloadingStateView to match the loading view of your app.


- TypeScript
- JavaScript
AddMembersDemo.tsx
EmptyStateView
You can set a customEmptyStateView using emptyStateView to match the empty view of your app.


- TypeScript
- JavaScript
AddMembersDemo.tsx
ErrorStateView
You can set a customErrorStateView using errorStateView to match the error view of your app.


- TypeScript
- JavaScript
AddMembersDemo.tsx
Menus
You can set the Custom Menu view to add more options to the Add Members component.
- TypeScript
- JavaScript
AddMembersDemo.tsx
Options
You can set the Custom options to the Add Members component.
- TypeScript
- JavaScript
AddMembersDemo.tsx