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

# Users

> Users — CometChat documentation.

## Overview

The `CometChatUsers` is a [Widget](/ui-kit/flutter/v4/components-overview#components), showcasing an accessible list of all available users. It provides an integral search functionality, allowing you to locate any specific user swiftly and easily. For each user listed, the widget displays the user's name by default, in conjunction with their avatar when available. Furthermore, it includes a status indicator, visually informing you whether a user is currently online or offline.

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/JSRiWiPGBHsJZFCg/images/9da5822a-users_overview_cometchat_screens-e32ac7e306bdc516808a1b8ae1b7f484.png?fit=max&auto=format&n=JSRiWiPGBHsJZFCg&q=85&s=c3167b169dba010b27feb27ecb73c9ba" alt="Image" width="4498" height="3121" data-path="images/9da5822a-users_overview_cometchat_screens-e32ac7e306bdc516808a1b8ae1b7f484.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/ubfBSdV1t6rmjxeA/images/86fd67e1-users_overview_cometchat_screens-4736af8d12a684d7b3c7937d7318cece.png?fit=max&auto=format&n=ubfBSdV1t6rmjxeA&q=85&s=b63ea087f5435a129ae99e0e25cfb85a" alt="Image" width="4498" height="3121" data-path="images/86fd67e1-users_overview_cometchat_screens-4736af8d12a684d7b3c7937d7318cece.png" />
  </Tab>
</Tabs>

The `CometChatUsers` widget is composed of the following Base Widgets:

| Widgets                                  | Description                                                                                                          |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| [ListBase](/ui-kit/flutter/v4/list-base) | a reusable container widget having title, search box, customisable background and a List View                        |
| [ListItem](/ui-kit/flutter/v4/list-item) | a widget that renders data obtained from a User object on a Tile having a title, subtitle, leading and trailing view |

## Usage

### Integration

As `CometChatUsers` is a custom **widget**, it can be launched directly by user actions such as button clicks or other interactions. It's also possible to integrate it into a **tab widget**. `CometChatUsers` offers several parameters and methods for UI customization.

You can launch `CometChatUsers` directly using `Navigator.push`, or you can define it as a widget within the `build` method of your `State` class.

##### 1. Using Navigator to Launch `CometChatUsers`

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    Navigator.push(context, MaterialPageRoute(builder: (context) => const CometChatUsers()));
    ```
  </Tab>
</Tabs>

##### 2. Embedding `CometChatUsers` as a Widget in the build Method

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
    import 'package:flutter/material.dart';

    class Users extends StatefulWidget {
      const Users({super.key});

      @override
      State<Users> createState() => _UsersState();
    }

    class _UsersState extends State<Users> {

      @override
      Widget build(BuildContext context) {
        return const Scaffold(
            body: SafeArea(
                child: CometChatUsers()
            )
        );
      }
    }
    ```
  </Tab>
</Tabs>

***

### Actions

[Actions](/ui-kit/flutter/v4/components-overview#actions) dictate how a widget functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the widget to fit your specific needs.

##### 1. onSelection

When the `onSelection` event is triggered, it furnishes the list of selected users. This event can be invoked by any button or action within the interface. You have the flexibility to implement custom actions or behaviors based on the selected users.

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.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      selectionMode: SelectionMode.multiple,
      activateSelection: ActivateSelection.onClick,
      onSelection: (list, context) {
        //TODO: This action will trigger the end of selection.
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 2. onItemTap

The `onItemTap` method is used to override the onClick behavior in `CometChatUsers`. 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.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      onItemTap: (context, user) {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 3. onBack

This method allows users to override the onBack Pressed behavior in `CometChatUsers` by utilizing the `onBack` , providing customization options for handling the back action.

By default, this action has a predefined behavior: it simply dismisses the current widget. However, the flexibility of CometChat UI Kit allows you to override this standard behavior according to your application's specific requirements. You can define a custom action that will be performed instead when the back button is pressed.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      onBack: () {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 4. onError

This method `onError`, allows users to override error handling within `CometChatUsers`, providing greater control over error responses and actions.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      onError: (e) {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 5. onItemLongPress

This method `onItemLongPress`, empowers users to customize long-click actions within `CometChatUsers`, offering enhanced functionality and interaction possibilities.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      onItemLongPress: (context, user) {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

### Filters

**Filters** allow you to customize the data displayed in a list within a Widget. 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](/sdk/flutter/retrieve-users) enables you to filter and customize the user 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](/sdk/flutter/retrieve-users)

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
        usersRequestBuilder: UsersRequestBuilder()
            ..limit = 10
    )
    ```
  </Tab>
</Tabs>

***

### Events

[Events](/ui-kit/flutter/v4/components-overview#events) are emitted by a `CometChatUsers` Widget. 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 Users you have to add corresponding listeners by using `CometChatUserEvents`

| Events          | Description                                                           |
| --------------- | --------------------------------------------------------------------- |
| ccUserBlocked   | This will get triggered when the logged in user blocks another user   |
| ccUserUnblocked | This will get triggered when the logged in user unblocks another user |

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
    import 'package:flutter/material.dart';

    class YourScreen extends StatefulWidget {
      const YourScreen({super.key});

      @override
      State<YourScreen> createState() => _YourScreenState();
    }

    class _YourScreenState extends State<YourScreen> with CometChatUserEventListener {

      @override
      void initState() {
        super.initState();
        CometChatUserEvents.addUsersListener("listenerId", this);
      }

      @override
      void dispose(){
        super.dispose();
        CometChatUserEvents.removeUsersListener("listenerId");
      }

      @override
      void ccUserBlocked(User user) {
        // TODO
      }

      @override
      void ccUserUnblocked(User user) {
        // TODO
      }

      @override
      Widget build(BuildContext context) {
        return const Placeholder();
      }

    }
    ```
  </Tab>
</Tabs>

***

## Customization

To fit your app's design requirements, you can customize the appearance of the `CometChatUsers` widget. 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 widget in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the widget.

##### 1. Users Style

You can set the `UsersStyle` to the `CometChatUsers` widget to customize the styling.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      usersStyle: UsersStyle(
        background: Color(0xFFE4EBF5),
        titleStyle: TextStyle(color: Colors.red),
        backIconTint: Colors.red
      ),
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/fxK75AS6FzDL1Oqo/images/b6d20351-users_style_cometchat_screens-c87b1040a11b3a971f9f959d8fb5ad86.png?fit=max&auto=format&n=fxK75AS6FzDL1Oqo&q=85&s=a3f08b984ad41a22a96a214f2d146b1d" alt="Image" width="4498" height="3121" data-path="images/b6d20351-users_style_cometchat_screens-c87b1040a11b3a971f9f959d8fb5ad86.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/NN4EdpOU3viwWMb_/images/0cdb2e2b-users_style_cometchat_screens-19c8b055314b8d0749b68d6be5d19a55.png?fit=max&auto=format&n=NN4EdpOU3viwWMb_&q=85&s=28119c18a218ba369d6a602a3f3557b9" alt="Image" width="4498" height="3121" data-path="images/0cdb2e2b-users_style_cometchat_screens-19c8b055314b8d0749b68d6be5d19a55.png" />
  </Tab>
</Tabs>

List of properties exposed by UsersStyle

| Property                 | Data Type               | Description                                                  |
| ------------------------ | ----------------------- | ------------------------------------------------------------ |
| `titleStyle`             | `TextStyle?`            | Text style for the title within the `CometChatUsers` widget. |
| `backIconTint`           | `Color?`                | Tint color for the back icon.                                |
| `searchBorderColor`      | `Color?`                | Border color for the search input box.                       |
| `searchBackground`       | `Color?`                | Background color for the search input box.                   |
| `searchBorderRadius`     | `BorderRadius?`         | Border radius for the search input box.                      |
| `searchIconTint`         | `Color?`                | Tint color for the search icon.                              |
| `searchBorderWidth`      | `double?`               | Border width for the search input box.                       |
| `searchPlaceholderStyle` | `TextStyle?`            | Text style for the placeholder text in the search input box. |
| `searchTextStyle`        | `TextStyle?`            | Text style for the search input text.                        |
| `loadingIconTint`        | `Color?`                | Tint color for the loading icon.                             |
| `emptyTextStyle`         | `TextStyle?`            | Text style for the empty state text.                         |
| `errorTextStyle`         | `TextStyle?`            | Text style for the error state text.                         |
| `sectionHeaderTextStyle` | `TextStyle?`            | Text style for the section headers.                          |
| `onlineStatusColor`      | `Color?`                | Color indicating the online status of users.                 |
| `separatorColor`         | `Color?`                | Color of the separators between list items.                  |
| `selectionIconTint`      | `Color?`                | Tint color for the selection icon.                           |
| `submitIconTint`         | `Color?`                | Tint color for the submit icon.                              |
| `width`                  | `double?`               | Width of the `CometChatUsers` widget.                        |
| `height`                 | `double?`               | Height of the `CometChatUsers` widget.                       |
| `background`             | `Color?` or `Gradient?` | Background color or gradient of the `CometChatUsers` widget. |
| `border`                 | `Border?`               | Border of the `CometChatUsers` widget.                       |
| `borderRadius`           | `BorderRadius?`         | Border radius of the `CometChatUsers` widget.                |
| `gradient`               | `Gradient?`             | Gradient background of the `CometChatUsers` widget.          |

##### 2. Avatar Style

To apply customized styles to the `Avatar` widget in the `CometChatUsers` widget, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/flutter/v4/avatar)

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      avatarStyle: AvatarStyle(
          border: Border.all(width: 5),
          borderRadius: 20,
          background: Colors.red
      ),
    )
    ```
  </Tab>
</Tabs>

***

##### 3. StatusIndicator Style

To apply customized styles to the Status Indicator widget in the `CometChatUsers` widget, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/flutter/v4/status-indicator)

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      statusIndicatorStyle: StatusIndicatorStyle(
          borderRadius: 10,
          gradient: LinearGradient(colors: [Colors.red, Colors.orange], begin: Alignment.topLeft, end: Alignment.bottomRight)
      ),
    )
    ```
  </Tab>
</Tabs>

***

### Functionality

These are a set of small functional customizations that allow you to fine-tune the overall experience of the widget. With these, you can change text, set custom icons, and toggle the visibility of UI elements.

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/k0f_g7UwNe_JINeP/images/436abcd0-users_functionality_cometchat_screens-59cf02b052d9ebca7157597050d5560f.png?fit=max&auto=format&n=k0f_g7UwNe_JINeP&q=85&s=9845442f2368462cf9870b79af53798a" alt="Image" width="4498" height="3121" data-path="images/436abcd0-users_functionality_cometchat_screens-59cf02b052d9ebca7157597050d5560f.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/Gp90C5sdVtuRR4t7/images/7de56acd-users_functionality_cometchat_screens-18caf79dc427656701f492a2b9ea427e.png?fit=max&auto=format&n=Gp90C5sdVtuRR4t7&q=85&s=678a053c1fed931d2e11af93867526ed" alt="Image" width="4498" height="3121" data-path="images/7de56acd-users_functionality_cometchat_screens-18caf79dc427656701f492a2b9ea427e.png" />
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      title: "Your Title",
      backButton: Icon(Icons.add_alert, color: Color(0xFF6851D6)),
      searchPlaceholder: "Search Users",
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/7emVxEQ5MCxvzC60/images/1bcea0c5-users_functionality_after_cometchat_screens-9b66f249be7b4d562907e03c7345c30b.png?fit=max&auto=format&n=7emVxEQ5MCxvzC60&q=85&s=16bfd7bb9a54b864734b55f41f48229b" alt="Image" width="4498" height="3121" data-path="images/1bcea0c5-users_functionality_after_cometchat_screens-9b66f249be7b4d562907e03c7345c30b.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mq8rEbFfi0JjKmkM/images/644593f9-users_functionality_after_cometchat_screens-fefb34b0c95a52d3a90c786396e7de29.png?fit=max&auto=format&n=mq8rEbFfi0JjKmkM&q=85&s=6755ff0a68124c627d92319547239a06" alt="Image" width="4498" height="3121" data-path="images/644593f9-users_functionality_after_cometchat_screens-fefb34b0c95a52d3a90c786396e7de29.png" />
  </Tab>
</Tabs>

List of properties exposed by `CometChatUsers`

| Property               | Data Type | Description                                                              |
| ---------------------- | --------- | ------------------------------------------------------------------------ |
| `hideSeparator`        | `bool`    | Flag indicating whether to hide separators between list items.           |
| `theme`                | `Theme?`  | Theme object for customizing the appearance of the widget.               |
| `searchPlaceholder`    | `String?` | Placeholder text for the search input box.                               |
| `backButton`           | `Widget?` | Widget for the back button in the app bar.                               |
| `showBackButton`       | `bool`    | Flag indicating whether to show the back button in the app bar.          |
| `searchBoxIcon`        | `Widget?` | Widget for the search box icon.                                          |
| `hideSearch`           | `bool`    | Flag indicating whether to hide the search input box.                    |
| `title`                | `String?` | Title of the widget or widget.                                           |
| `errorStateText`       | `String?` | Text to display in the error state view.                                 |
| `emptyStateText`       | `String?` | Text to display in the empty state view.                                 |
| `hideError`            | `bool`    | Flag indicating whether to hide the error state view.                    |
| `hideSectionSeparator` | `bool`    | Flag indicating whether to hide separators between sections in the list. |
| `disableUsersPresence` | `bool`    | Flag indicating whether to disable users' presence status indicators.    |
| `selectionIcon`        | `Widget?` | Widget for displaying the selection icon in the app bar.                 |
| `submitIcon`           | `Widget?` | Widget for displaying the submit icon in the app bar.                    |
| `hideAppbar`           | `bool`    | Flag indicating whether to hide the app bar.                             |

***

### Advance

For advanced-level customization, you can set custom views to the widget. This lets you tailor each aspect of the widget to fit your exact needs and application aesthetics. You can create and define your own widget and then incorporate those into the widget.

***

#### ListItemView

With this function, you can assign a custom ListItem to the `CometChatUsers` Widget.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      listItemView: (user) {
        return Placeholder();
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/_MYSdWhXnUkTkjEH/images/46a90564-users_list_item_view_cometchat_screens-12fa740760180723d2c74ef5100893b9.png?fit=max&auto=format&n=_MYSdWhXnUkTkjEH&q=85&s=21e3328a891f243efb65b93d18ba149e" alt="Image" width="4498" height="3121" data-path="images/46a90564-users_list_item_view_cometchat_screens-12fa740760180723d2c74ef5100893b9.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2JiXkJ8lq6PmPGlJ/images/6c7da6ca-users_list_item_view_cometchat_screens-9736f171657d5308776ffb7cbe03cdcf.png?fit=max&auto=format&n=2JiXkJ8lq6PmPGlJ&q=85&s=46eca476073b96231d171d66aedc03c2" alt="Image" width="4498" height="3121" data-path="images/6c7da6ca-users_list_item_view_cometchat_screens-9736f171657d5308776ffb7cbe03cdcf.png" />
  </Tab>
</Tabs>

**Example**

Here is the complete example for reference:

<Tabs>
  <Tab title="Dart">
    ```dart custom_list_item.dart theme={null}
    import 'package:flutter/material.dart';
    import 'package:flutter_uikit_docs_sample_app/utils/custom_colors.dart';
    import 'package:intl/intl.dart';

    class CustomListItems extends StatelessWidget {
      final String name;
      final DateTime? lastMessageTime;
      final String? avatarUrl;

      const CustomListItems({
        super.key,
        required this.name,
        this.lastMessageTime,
        this.avatarUrl,
      });

      String formatDateTime(DateTime dateTime) {
        final now = DateTime.now();
        final difference = now.difference(dateTime);

        if (difference.inDays == 0) {
          return DateFormat('HH:mm').format(dateTime);
        } else if (difference.inDays == 1) {
          return 'Yesterday';
        } else {
          return DateFormat('yyyy-MM-dd').format(dateTime);
        }
      }

      @override
      Widget build(BuildContext context) {
        return Container(
          margin: const EdgeInsets.only(top: 5, bottom: 5),
          padding: const EdgeInsets.all(8.0),
          decoration: BoxDecoration(
            border: Border.all(color: Color(0xFF6851D6), width: 1), // Example border color
            borderRadius: BorderRadius.circular(8.0),
            color: Color(0xFFEEEEEE)
          ),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      name,
                      style: const TextStyle(
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    lastMessageTime == null ? Container() : Text(formatDateTime(lastMessageTime!)),
                  ],
                ),
              ),
              const SizedBox(width: 8.0),
              if (avatarUrl != null)
                ClipOval(
                  child: Image.network(
                    avatarUrl!,
                    width: 40.0,
                    height: 40.0,
                    fit: BoxFit.cover,
                    errorBuilder: (context, error, stackTrace) {
                      return const Icon(
                        Icons.person,
                        size: 40.0,
                      );
                    },
                  ),
                )
              else
                const Icon(
                  Icons.person,
                  size: 40.0,
                ),
            ],
          ),
        );
      }
    }
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Dart">
    ```dart main.dart theme={null}
    CometChatUsers(
      listItemView: (user) {
        return CustomListItems(
          name: user.name,
          avatarUrl: user.avatar,
        );
      },
    )
    ```
  </Tab>
</Tabs>

***

#### SubtitleView

You can customize the subtitle view for each item to meet your specific preferences and needs.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      subtitleView: (context, conversation) {
        return const Row(
          children: [
            Icon(Icons.call, color: Color(0xFF6851D6), size: 25,),
            SizedBox(width: 10),
            Icon(Icons.video_call, color: Color(0xFF6851D6), size: 25,),
          ],
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/xIG5VBdyNJ5cYSqE/images/cfebdf43-users_subtitle_view_cometchat_screens-92f242f1e7458aa7a4f2474625f3f490.png?fit=max&auto=format&n=xIG5VBdyNJ5cYSqE&q=85&s=87a969cf8b9ceea277bbc654a968bf48" alt="Image" width="4498" height="3121" data-path="images/cfebdf43-users_subtitle_view_cometchat_screens-92f242f1e7458aa7a4f2474625f3f490.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/ugckbRl5Q-H7t8X2/images/e0268953-users_subtitle_view_cometchat_screens-aa13d5b9f8ace1a625a13004561c2117.png?fit=max&auto=format&n=ugckbRl5Q-H7t8X2&q=85&s=04c3f9759fe91212a5863e9185bb9e4b" alt="Image" width="4498" height="3121" data-path="images/e0268953-users_subtitle_view_cometchat_screens-aa13d5b9f8ace1a625a13004561c2117.png" />
  </Tab>
</Tabs>

***

#### AppBarOptions

You can set the Custom AppBarOptions to the Conversations widget.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      appBarOptions: (context) {
        return [
          InkWell(
            onTap: () {
              // TODO
            },
            child: const Icon(Icons.ac_unit, color: Color(0xFF6851D6)),
          ),
          const SizedBox(width: 10)
        ];
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/xIG5VBdyNJ5cYSqE/images/d47b7f36-users_set_menu_cometchat_screens-cc8563b25838cab5467aa2a9353d23fe.png?fit=max&auto=format&n=xIG5VBdyNJ5cYSqE&q=85&s=409137b64a6e6b8289ba8524704f15a2" alt="Image" width="4498" height="3121" data-path="images/d47b7f36-users_set_menu_cometchat_screens-cc8563b25838cab5467aa2a9353d23fe.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/fxK75AS6FzDL1Oqo/images/b75b5c0e-users_set_menu_cometchat_screens-9307c3f5f9b75c88ed5a7f6bec431c35.png?fit=max&auto=format&n=fxK75AS6FzDL1Oqo&q=85&s=1bde635cae1789889ad9e8fa45c487e2" alt="Image" width="4498" height="3121" data-path="images/b75b5c0e-users_set_menu_cometchat_screens-9307c3f5f9b75c88ed5a7f6bec431c35.png" />
  </Tab>
</Tabs>

***

#### EmptyStateView

You can set a custom `EmptyStateView` using `setEmptyStateView` to match the empty view of your app.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      emptyStateView: (context) {
        return const Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Spacer(),
            Icon(Icons.error_outline, color: Colors.red, size: 100,),
            SizedBox(height: 20,),
            Text("Your Custom Error Message"),
            Spacer(),
          ],
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/PaxBG9I1yMoeQmt2/images/346e14fb-users_set_empty_state_view_cometchat_screens-651c528d4a47cdc3e3138e41910655b9.png?fit=max&auto=format&n=PaxBG9I1yMoeQmt2&q=85&s=145f0db5122b0c6046e83e6abd5ffce7" alt="Image" width="4498" height="3121" data-path="images/346e14fb-users_set_empty_state_view_cometchat_screens-651c528d4a47cdc3e3138e41910655b9.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mNTojjz_O28of40c/images/f28e5cb8-users_set_empty_state_view_cometchat_screens-eac7c3ad473e058816a21c00b803e75c.png?fit=max&auto=format&n=mNTojjz_O28of40c&q=85&s=2cbe888cbffbd329529fbc7ed91469c6" alt="Image" width="4498" height="3121" data-path="images/f28e5cb8-users_set_empty_state_view_cometchat_screens-eac7c3ad473e058816a21c00b803e75c.png" />
  </Tab>
</Tabs>

***

#### ErrorStateView

You can set a custom `ErrorStateView` using `setErrorStateView` to match the error view of your app.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatUsers(
      errorStateView: (context) {
        return SizedBox(
          width: MediaQuery.of(context).size.width,
          child: const Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Spacer(),
              Icon(Icons.error_outline, color: Colors.red, size: 100,),
              SizedBox(height: 20,),
              Text("Your Custom Error Message"),
              Spacer(),
            ],
          ),
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/_MYSdWhXnUkTkjEH/images/4e263c8f-users_set_error_state_view_cometchat_screens-00ec577c2ca4e426503f45d6f78f91f1.png?fit=max&auto=format&n=_MYSdWhXnUkTkjEH&q=85&s=901378d1804c19de8c46580c9d18e489" alt="Image" width="4498" height="3121" data-path="images/4e263c8f-users_set_error_state_view_cometchat_screens-00ec577c2ca4e426503f45d6f78f91f1.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/Gp90C5sdVtuRR4t7/images/7f71b34a-users_set_error_state_view_cometchat_screens-a090cbaeabe3ce9b5d819b8b6c388819.png?fit=max&auto=format&n=Gp90C5sdVtuRR4t7&q=85&s=120e2be6ede43bc1add8f5bfdb6e4267" alt="Image" width="4498" height="3121" data-path="images/7f71b34a-users_set_error_state_view_cometchat_screens-a090cbaeabe3ce9b5d819b8b6c388819.png" />
  </Tab>
</Tabs>

***

#### LoadingStateView

You can set a custom loader widget using `loadingStateView` to match the loading UI of your app.

<Tabs>
  <Tab title="Dart">
    ```dart widget theme={null}
    CometChatUsers(
      loadingStateView: (context) {
        return Placeholder(); // Replace this placeholder with your custom widget.
      },
    )
    ```
  </Tab>
</Tabs>

Here is the complete example for reference:

**Example**

<Tabs>
  <Tab title="Dart">
    ```dart main.dart theme={null}
    CometChatUsers(
      loadingStateView: (context) {
        return Container(
          width: MediaQuery.of(context).size.width,
          child: Center(
              child: CircularProgressIndicator()
          ),
        ); // Replaced the placeholder with a custom widget.
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/jpEUuHUk-hvu4tQT/images/a662f00e-users_set_loading_state_view_cometchat_screens-c6cfdf499aa8c9bb9f9a51453e8a234b.png?fit=max&auto=format&n=jpEUuHUk-hvu4tQT&q=85&s=ec7e2527dc574cf6097c80e7846df2a7" alt="Image" width="4498" height="3121" data-path="images/a662f00e-users_set_loading_state_view_cometchat_screens-c6cfdf499aa8c9bb9f9a51453e8a234b.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/FGBCGWXGo5d9bVxR/images/c03122cf-users_set_loading_state_view_cometchat_screens-897ea01ed4547aafc8ec2c4b78cadc7e.png?fit=max&auto=format&n=FGBCGWXGo5d9bVxR&q=85&s=7299ad438546bbaf2b8592e775b145f3" alt="Image" width="4498" height="3121" data-path="images/c03122cf-users_set_loading_state_view_cometchat_screens-897ea01ed4547aafc8ec2c4b78cadc7e.png" />
  </Tab>
</Tabs>

***
