> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-feature-react-native-sdk-quotedmessage-a.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Message Header

## Overview

`MessageHeader` is a [Component](/ui-kit/react-native/components-overview#components) that showcases the [User](/sdk/react-native/users-overview) or [Group](/sdk/react-native/groups-overview) details in the toolbar. Furthermore, it also presents a typing indicator and a back navigation button for ease of use.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-feature-react-native-sdk-quotedmessage-a/Lc9mXSk8oVxt1t7p/images/6fc1ac0d-message_header-3ef4b07948db07a2ec0b2aca8bcdc221.png?fit=max&auto=format&n=Lc9mXSk8oVxt1t7p&q=85&s=fe855f9bd51a1cbf26c99adea3ee142b" width="1280" height="240" data-path="images/6fc1ac0d-message_header-3ef4b07948db07a2ec0b2aca8bcdc221.png" />
</Frame>

***

## Usage

### Integration

You can add `CometChatMessageHeader` component directly into your component file.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    //code
    return <CometChatMessageHeader group={group} />;
    ```
  </Tab>
</Tabs>

### Actions

[Actions](/ui-kit/react-native/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.

The `MessageHeader` component does not have any exposed actions.

##### onError

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

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    //code
    return (
      <CometChatMessageHeader
        group={group}
        onError={(error: CometChat.CometChatException) => {
          //handle error
        }}
      />
    );
    ```
  </Tab>
</Tabs>

##### onBack

`onBack` is triggered when you press the back button in the app bar. It has a predefined behavior; when clicked, it navigates to the previous activity. However, you can override this action using the following code snippet.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    //code
    return (
      <CometChatMessageHeader
        group={group}
        onBack={() => {
          //handle back
        }}
      />
    );
    ```
  </Tab>
</Tabs>

***

***

##### onNewChatButtonClick

`onNewChatButtonClick` is triggered when you press the new chat button in the app bar (only applies to @agentic users). This callback allows you to handle starting a new conversation with the AI assistant.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    //code
    return (
      <CometChatMessageHeader
        user={user}
        onNewChatButtonClick={() => {
          // Handle new chat button click
          console.log('Starting new AI chat');
        }}
      />
    );
    ```
  </Tab>
</Tabs>

***

##### onChatHistoryButtonClick

`onChatHistoryButtonClick` is triggered when you press the chat history button in the app bar (only applies to @agentic users). This callback allows you to handle opening the AI assistant chat history.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    //code
    return (
      <CometChatMessageHeader
        user={user}
        onChatHistoryButtonClick={() => {
          // Handle chat history button click
          console.log('Opening AI chat history');
        }}
      />
    );
    ```
  </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.

The `MessageHeader` component does not have any exposed filters.

### Events

[Events](/ui-kit/react-native/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 `MessageHeader` component does not produce any events.

## Customization

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

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-feature-react-native-sdk-quotedmessage-a/NYlKVet_SWy5r_yh/images/c761803d-message_header_styling-ae4670a5a130374818f37e2144246748.png?fit=max&auto=format&n=NYlKVet_SWy5r_yh&q=85&s=255958579d6a50edb204eebd37b59909" width="1280" height="240" data-path="images/c761803d-message_header_styling-ae4670a5a130374818f37e2144246748.png" />
</Frame>

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    //code
    return (
      <CometChatMessageHeader
        group={group}
        style={{
          avatarStyle: {
            containerStyle: {
              borderRadius: 8,
              backgroundColor: "#FBA46B",
            },
            imageStyle: {
              borderRadius: 8,
            },
          },
          titleTextStyle: {
            color: "#F76808",
          },
          callButtonStyle: {
            audioCallButtonIconStyle: {
              tintColor: "#F76808",
            },
            videoCallButtonIconStyle: {
              tintColor: "#F76808",
            },
          },
        }}
      />
    );
    ```
  </Tab>
</Tabs>

***

To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_message_header.xml).

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

Following is a list of customizations along with their corresponding code snippets:

| Property                  | Description                                                                              | Code                           |
| ------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------ |
| **user**                  | Used to pass user object of which header specific details will be shown                  | `user={chatUser}`              |
| **group**                 | Used to pass group object of which header specific details will be shown                 | `group={chatGroup}`            |
| **showBackButton**        | Used to toggle back button visibility                                                    | `showBackButton={true}`        |
| **hideVoiceCallButton**   | Used to toggle voice call button visibility                                              | `hideVoiceCallButton={true}`   |
| **hideVideoCallButton**   | Used to toggle video call button visibility                                              | `hideVideoCallButton={true}`   |
| **usersStatusVisibility** | Used to toggle user status visibility                                                    | `usersStatusVisibility={true}` |
| **hideNewChatButton**     | Used to toggle the visibility of new chat button in case of chats with AI Assistants     | `hideNewChatButton={true}`     |
| **hideChatHistoryButton** | Used to toggle the visibility of chat history button in case of chats with AI Assistants | `hideChatHistoryButton={true}` |

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

#### AuxiliaryButtonView

Allows adding custom buttons that replace the default call buttons.

Use Cases:

* Add a Call button (📞) for quick voice/video calls.
* Include a Block/Report button for moderation.
* Implement a Pin Chat feature.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    //code
    return (
      <CometChatMessageHeader
        group={group}
        AuxiliaryButtonView={({
          user,
          group,
        }: {
          user?: CometChat.User;
          group?: CometChat.Group;
        }) => {
          return (
            <TouchableOpacity
              onPress={() => {
                //do something
              }}
            >
              <Text>Custom Button</Text>
            </TouchableOpacity>
          );
        }}
      />
    );
    ```
  </Tab>
</Tabs>

***

#### ItemView

Enables replacing the entire default header with a fully customized ListItem layout.

Use Cases:

* Create a completely unique message header style.
* Include additional user details like bio, location, or last seen status.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    //code
    const getItemView = ({
      user,
      group,
    }: {
      user?: CometChat.User;
      group?: CometChat.Group;
    }) => {
      //your custom item view
      //return jsx;
    };
    return (
      <CometChatMessageHeader
        group={group}
        ItemView={getItemView}
      />
    );
    ```
  </Tab>
</Tabs>

***

#### SubtitleView

Allows customizing the subtitle view, usually used for status messages or additional details.

Use Cases:

* Show the user's last seen or online status.
* Display a custom typing indicator.
* Show a custom role or tagline ("Customer Support", "Verified Seller").

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    //code
    const getSubtitleView = ({
      user,
      group,
    }: {
      user?: CometChat.User;
      group?: CometChat.Group;
    }) => {
      //your custom Subtitle view
      //return jsx;
    };
    return (
      <CometChatMessageHeader
        group={group}
        SubtitleView={getSubtitleView}
      />
    );
    ```
  </Tab>
</Tabs>

**Example**

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-feature-react-native-sdk-quotedmessage-a/-VkygUOl1ts-0wu1/images/b408416f-message_header_subtitle_view-be9b7d171337920165f41323606589e9.png?fit=max&auto=format&n=-VkygUOl1ts-0wu1&q=85&s=dde05297348c5406f9c65dbf6c0c0a81" width="1280" height="240" data-path="images/b408416f-message_header_subtitle_view-be9b7d171337920165f41323606589e9.png" />
</Frame>

***

#### LeadingView

Defines a custom leading view, typically used for the receiver's profile picture or avatar.

Use Cases:

* Display a circular profile picture with a status indicator.
* Add a custom badge for special roles (Admin, Verified ✅).

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    //code
    const getLeadingView = ({
      user,
      group,
    }: {
      user?: CometChat.User;
      group?: CometChat.Group;
    }) => {
      //your custom Leading view
      //return jsx;
    };
    return (
      <CometChatMessageHeader
        group={group}
        LeadingView={getLeadingView}
      />
    );
    ```
  </Tab>
</Tabs>

**Example**

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-feature-react-native-sdk-quotedmessage-a/Lc9mXSk8oVxt1t7p/images/6fc1ac0d-message_header-3ef4b07948db07a2ec0b2aca8bcdc221.png?fit=max&auto=format&n=Lc9mXSk8oVxt1t7p&q=85&s=fe855f9bd51a1cbf26c99adea3ee142b" width="1280" height="240" data-path="images/6fc1ac0d-message_header-3ef4b07948db07a2ec0b2aca8bcdc221.png" />
</Frame>

***

#### TrailingView

Enables customization of the trailing view which gets added next to the call buttons.

Use Cases:

* Add an options menu (⋮) for more actions.
* Display a mute/unmute toggle.
* Show a connection strength indicator for calls.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChatMessageHeader } from "@cometchat/chat-uikit-react-native";
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    //code
    const getTrailingView = ({
      user,
      group,
    }: {
      user?: CometChat.User;
      group?: CometChat.Group;
    }) => {
      //your custom Trailing view
      //return jsx;
    };
    return (
      <CometChatMessageHeader
        group={group}
        TrailingView={getTrailingView}
      />
    );
    ```
  </Tab>
</Tabs>

**Example**

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-feature-react-native-sdk-quotedmessage-a/DHfasVbiAENM-XY2/images/9e1f135d-message_header_menu-b41c7675805df674135444571760be25.png?fit=max&auto=format&n=DHfasVbiAENM-XY2&q=85&s=5def192eef187f15c6062df4b90421c5" width="1280" height="240" data-path="images/9e1f135d-message_header_menu-b41c7675805df674135444571760be25.png" />
</Frame>
