> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-rn-guide-message-privately.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# User Member Wrapper

> User Member Wrapper — CometChat documentation.

## Overview

The `UserMemberWrapper` component is an intuitive interface that presents a list of users or group members according to the chat context. by default it shows the list of users.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2SVOPiSpm0QEqRoz/images/edb6d7e4-user_member_wrapper_overview_web_screens-b909422509fa288a52a46a2712a45763.png?fit=max&auto=format&n=2SVOPiSpm0QEqRoz&q=85&s=e000478ec7c45d99029a117daa3bc357" width="3600" height="2400" data-path="images/edb6d7e4-user_member_wrapper_overview_web_screens-b909422509fa288a52a46a2712a45763.png" />
</Frame>

## Usage

### Integration

The following code snippet illustrates how you can directly incorporate the CometChatUserMemberWrapper component into your app.

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import { CometChatUserMemberWrapper } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      return <CometChatUserMemberWrapper />;
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>

  <Tab title="App.tsx">
    ```typescript theme={null}
    import { UserMemberWrapperDemo } from "./UserMemberWrapperDemo";

    export default function App() {
      return (
        <div className="App">
          <div>
            <UserMemberWrapperDemo />
          </div>
        </div>
      );
    }
    ```
  </Tab>
</Tabs>

***

### Actions

[Actions](/ui-kit/react/v4/components-overview#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. onItemClick

`onItemClick` is triggered when you click on a ListItem of UserMemberWrapper component. You can override this action using the following code snippet.

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import { CometChatUserMemberWrapper } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      const handleOnItemClick = () => {
        console.log("Your custom actions");
      };

      return <CometChatUserMemberWrapper onItemClick={handleOnItemClick} />;
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

***

#### 2. onError

This action doesn't change the behavior of the component but rather listens for any errors that occur in the UserMemberWrapper component.

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import { CometChatUserMemberWrapper } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      function handleError(): void {
        console.log("your custom on error actions");
      }

      return <CometChatUserMemberWrapper onError={handleError} />;
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

***

#### 3. onEmpty

This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import { CometChatUserMemberWrapper } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      const getOnEmpty = () => {
        console.log("your custom on empty actions");
      };

      return <CometChatUserMemberWrapper onEmpty={getOnEmpty} />;
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

***

### 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.

You can set `usersRequestBuilder`and `groupMemberRequestBuilder` in the UserMemberWrapper Component to filter the list. You can modify the builder as per your specific requirements with multiple options available to know more refer to [UsersRequestBuilder](/sdk/javascript/retrieve-users) and [GroupMemberRequestBuilder](/sdk/javascript/retrieve-group-members)

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/FGBCGWXGo5d9bVxR/images/c45861d4-user_member_wrapper_filter_web_screens-be197d0ab403ecad267a8c1dc872cf75.png?fit=max&auto=format&n=FGBCGWXGo5d9bVxR&q=85&s=dd9b20fc073ea75c2f764156aba94694" width="3600" height="2400" data-path="images/c45861d4-user_member_wrapper_filter_web_screens-be197d0ab403ecad267a8c1dc872cf75.png" />
</Frame>

<Tabs>
  <Tab title="UsersRequestBuilder">
    UserMemberWrapperDemo.tsx

    ```typescript theme={null}
    import React from "react";
    import { CometChatUserMemberWrapper } from "@cometchat/chat-uikit-react";
    import { CometChat } from "@cometchat/chat-sdk-javascript";

    const UserMemberWrapperDemo = () => {
      return (
        <CometChatUserMemberWrapper
          usersRequestBuilder={new CometChat.UsersRequestBuilder().setLimit(2)}
        />
      );
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>

  <Tab title="GroupMemberRequestBuilder">
    UserMemberWrapperDemo.tsx

    ```typescript theme={null}
    import React from 'react';
    import { CometChatUserMemberWrapper } from '@cometchat/chat-uikit-react';
    import {CometChat} from '@cometchat/chat-sdk-javascript';

    const UserMemberWrapperDemo = () => {
    const [chatGroup, setChatGroup] = React.useState<CometChat.Group | undefined>();

        React.useEffect(() => {
            CometChat.getGroup("uid").then((group) => {
                setChatGroup(group);
            })
        }, [])
      return (
        <CometChatUserMemberWrapper
        group={chatGroup}
        groupMemberRequestBuilder={new CometChat.GroupMembersRequestBuilder('uid').setLimit(2)}
        />
      );
    }

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

***

### Events

[Events](/ui-kit/react/v4/components-overview#events) are emitted by a `Component`. 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.

The `CometChatUserMemberWrapper` component does not produce any events.

## Customization

To fit your app's design requirements, you can customize the appearance of the `UserMemberWrapper` 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. Avatar Style

If you want to apply customized styles to the `Avatar` component within the `UserMemberWrapper` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/19qJLi95IaEk2j9s/images/fc8e074c-user_member_wrapper_avatar_style_web_screens-ccef01d7d29b8792bd15536a2ca9239a.png?fit=max&auto=format&n=19qJLi95IaEk2j9s&q=85&s=851da1421f04d40929168ed9687d6753" width="3600" height="2400" data-path="images/fc8e074c-user_member_wrapper_avatar_style_web_screens-ccef01d7d29b8792bd15536a2ca9239a.png" />
</Frame>

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import {
      CometChatUserMemberWrapper,
      AvatarStyle,
    } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      const avatarStyle = new AvatarStyle({
        backgroundColor: "#cdc2ff",
        border: "2px solid #6745ff",
        borderRadius: "10px",
        outerViewBorderColor: "#ca45ff",
        outerViewBorderRadius: "5px",
        nameTextColor: "#4554ff",
      });

      return <CometChatUserMemberWrapper avatarStyle={avatarStyle} />;
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

***

#### 2. StatusIndicator Style

To apply customized styles to the Status Indicator component in the `UserMemberWrapper` Component, you can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/OOBJyP9hM0C-rAe_/images/dde4336d-user_member_wrapper_status_indicator_style_web_screens-72948f236fef940fde1221dc579799b6.png?fit=max&auto=format&n=OOBJyP9hM0C-rAe_&q=85&s=72470bfef68c93635e2a7cddf7377c64" width="3600" height="2400" data-path="images/dde4336d-user_member_wrapper_status_indicator_style_web_screens-72948f236fef940fde1221dc579799b6.png" />
</Frame>

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import { CometChatUserMemberWrapper } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      const statusIndicatorStyle = {
        color: "red",
        fontSize: "16px",
        fontWeight: "bold",
      };

      return (
        <CometChatUserMemberWrapper statusIndicatorStyle={statusIndicatorStyle} />
      );
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

***

### 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.

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import {
      CometChatUserMemberWrapper,
      UserMemberListType,
    } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      return (
        <CometChatUserMemberWrapper
          userMemberListType={UserMemberListType.users}
          disableUsersPresence={true}
        />
      );
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

below is a list of customizations along with corresponding code snippets

Below is a customizations list along with corresponding code snippets

| Property                           | Description                                                                                                                                                                                                 | Code                                                  |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| **userMemberListType**             | specifies whether the member list should display group members or individual users.                                                                                                                         | `userMemberListType={UserMemberListType.users}`       |
| **searchKeyword** [report]()       | allows users to filter and display only those items in a list that match the provided keyword.                                                                                                              | `searchKeyword='custom searchkeyword'`                |
| **disableLoadingState** [report]() | disable the loading state                                                                                                                                                                                   | `disableLoadingState={true}`                          |
| **disableUsersPresence**           | used to control visibility of status indicator shown if user is online                                                                                                                                      | `disableUsersPresence={true}`                         |
| **userPresencePlacement**          | determines the position where the user presence indicator is displayed relative to the user's avatar or name, with `right` or `bottom` indicating it's displayed to the right or bottom of the user's list. | `userPresencePlacement={UserPresencePlacement.right}` |
| **hideSeparator**                  | When set to true, hides the separator between the individual elements in the list.                                                                                                                          | `hideSeparator={true}`                                |
| **loadingIconUrl**                 | used to set the custom loading icon                                                                                                                                                                         | `loadingIconUrl='custom loading url'`                 |

***

### 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.

#### ListItemView

With the listItemVIew property, you can assign a custom ListItem to the UserMemberWrapper Component.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/PrOf0fpV33FkfOMB/images/16af738d-user_member_wrapper_advance_web_screens-195a385f2ba71494ceeba5b99f8312fb.png?fit=max&auto=format&n=PrOf0fpV33FkfOMB&q=85&s=046ea4bdd36439d824eea2c1886df382" width="3600" height="2400" data-path="images/16af738d-user_member_wrapper_advance_web_screens-195a385f2ba71494ceeba5b99f8312fb.png" />
</Frame>

<Tabs>
  <Tab title="UserMemberWrapperDemo.tsx">
    ```typescript theme={null}
    import React from "react";
    import {
      CometChatUserMemberWrapper,
      UserMemberListType,
    } from "@cometchat/chat-uikit-react";

    const UserMemberWrapperDemo = () => {
      const getListItemView = (
        item?: CometChat.User | CometChat.GroupMember
      ): JSX.Element => {
        //your custom list item view
        return <div>{item?.getName()}</div>;
      };
      return <CometChatUserMemberWrapper listItemView={getListItemView} />;
    };

    export default UserMemberWrapperDemo;
    ```
  </Tab>
</Tabs>

***
