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

# Call Buttons

> Call Buttons — CometChat documentation.

## Overview

The `Call Button` is a [Component](/ui-kit/react-native/v4/components-overview#components) provides users with the ability to make calls, access call-related functionalities, and control call settings. Clicking this button typically triggers the call to be placed to the desired recipient.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/3EDM5JvI4mnAULac/images/759e7d3b-call_buttons_overview_cometchat_screens-a7f7c081258072bc217e25d9b91d1dd9.png?fit=max&auto=format&n=3EDM5JvI4mnAULac&q=85&s=148ece06f776c6d0d81bc2663f975180" alt="Image" width="3500" height="1424" data-path="images/759e7d3b-call_buttons_overview_cometchat_screens-a7f7c081258072bc217e25d9b91d1dd9.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/le8ibYc8lBJsShSE/images/5122a113-call_buttons_overview_cometchat_screens-d8eaca0a23bd1d02783dcdac3b11029e.png?fit=max&auto=format&n=le8ibYc8lBJsShSE&q=85&s=a1f655f9f13bb0af29b61ecfd999beea" alt="Image" width="3500" height="1424" data-path="images/5122a113-call_buttons_overview_cometchat_screens-d8eaca0a23bd1d02783dcdac3b11029e.png" />
  </Tab>
</Tabs>

## Usage

### Integration

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatCallButtons } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

    	const [user, setUser] = useState<CometChat.User | undefined>(undefined);

        const getUser = async () => {
           const user = await CometChat.getUser('uid');
           setUser(user);
        };

    	useEffect(() => {
    	   //login
           getUser();
        }, []);


       return (
    	 { user &&
    	   <CometChatCallButtons
              user={user}
     	   />
    	 }
       );
     }
    ```
  </Tab>
</Tabs>

### Actions

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

`onVoiceCallPress` is triggered when you click the voice call button of the `Call Buttons` component. You can override this action using the following code snippet.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatCallButtons } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

    	const [user, setUser] = useState<CometChat.User | undefined>(undefined);

        const getUser = async () => {
           const user = await CometChat.getUser('uid');
           setUser(user);
        };

    	useEffect(() => {
    	   //login
           getUser();
        }, []);

    	const onVoiceCallPressHandler  = ({user, group}: {user?: CometChat.User | undefined,
          group?: CometChat.Group | undefined }
        ) => {
           //code
        }


       return (
    	 { user &&
    	   <CometChatCallButtons
              user={user}
    		  onVoiceCallPress={onVoiceCallPressHandler}
     	   />
    	 }
       );
     }
    ```
  </Tab>
</Tabs>

##### 2. onVideoCallClick

`onVideoCallClick` is triggered when you click the video call button of the `Call Buttons` component. You can override this action using the following code snippet.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatCallButtons } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

    	const [user, setUser] = useState<CometChat.User | undefined>(undefined);

        const getUser = async () => {
           const user = await CometChat.getUser('uid');
           setUser(user);
        };

    	useEffect(() => {
    	   //login
           getUser();
        }, []);

        const onVideoCallPressHandler  = ({user, group}: {user?: CometChat.User | undefined,
          group?: CometChat.Group | undefined }
        ) => {
           //code
        }


       return (
    	 { user &&
    	   <CometChatCallButtons
              user={user}
    		  onVideoCallPress={onVideoCallPressHandler}
     	   />
    	 }
       );
     }
    ```
  </Tab>
</Tabs>

##### 3. onError

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

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatCallButtons } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

    	const [user, setUser] = useState<CometChat.User | undefined>(undefined);

        const getUser = async () => {
           const user = await CometChat.getUser('uid');
           setUser(user);
        };

    	useEffect(() => {
    	   //login
           getUser();
        }, []);

        const onErrorHandler = (error: CometChat.CometChatException) => {
          //code
        }


       return (
    	 { user &&
    	   <CometChatCallButtons
              user={user}
    		  onError={onErrorHandler}
     	   />
    	 }
       );
     }
    ```
  </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 `Call Buttons` component does not have any exposed filters.

***

### Events

[Events](/ui-kit/react-native/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 list of events emitted by the `Call Buttons` component is as follows.

| Event              | Description                                                                  |
| ------------------ | ---------------------------------------------------------------------------- |
| **ccCallRejected** | This event is triggered when the initiated call is rejected by the receiver. |
| **ccCallFailled**  | This event is triggered when an error occurs during the intiated call.       |
| **ccOutgoingCall** | This event is triggered when the user initiates a voice/video call.          |

<Tabs>
  <Tab title="Adding Listeners">
    ```tsx theme={null}
    import { CometChatUIEventHandler } from "@cometchat/chat-uikit-react-native";

    CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
      ccCallRejected: ({ call }) => {
        //code
      },
    });

    CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
      ccOutgoingCall: ({ call }) => {
        //code
      },
    });

    CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
      ccCallFailled: ({ call }) => {
        //code
      },
    });
    ```
  </Tab>
</Tabs>

***

<Tabs>
  <Tab title="Removing Listeners">
    ```tsx theme={null}
    import { CometChatUIEventHandler } from "@cometchat/chat-uikit-react-native";

    CometChatUIEventHandler.removeCallListener("CALL_LISTENER_ID");
    ```
  </Tab>
</Tabs>

## Customization

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

To customize the appearance, you can assign a `CallButtonsStyle` object to the `Call Buttons` component.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/3EDM5JvI4mnAULac/images/7612798b-call_buttons_button_style_cometchat_screens-ed219b9bd4314945f9bdd65f73c06bfa.png?fit=max&auto=format&n=3EDM5JvI4mnAULac&q=85&s=5f3bc69c62763585bfabb5dd7beaab71" alt="Image" width="4498" height="1424" data-path="images/7612798b-call_buttons_button_style_cometchat_screens-ed219b9bd4314945f9bdd65f73c06bfa.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/_MYSdWhXnUkTkjEH/images/4f4294b2-call_buttons_button_style_cometchat_screens-5975b59370d32d545dbdbbacee33e23b.png?fit=max&auto=format&n=_MYSdWhXnUkTkjEH&q=85&s=464e3131b2651033b31d9bdbfafd88ef" alt="Image" width="4498" height="1424" data-path="images/4f4294b2-call_buttons_button_style_cometchat_screens-5975b59370d32d545dbdbbacee33e23b.png" />
  </Tab>
</Tabs>

In this example, we are employing the `callButtonsStyle`.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatCallButtons, CallButtonStyleInterface } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

    	const [user, setUser] = useState<CometChat.User | undefined>(undefined);

        const getUser = async () => {
           const user = await CometChat.getUser('uid');
           setUser(user);
        };

    	useEffect(() => {
    	   //login
           getUser();
        }, []);

       const callButtonsStyle : CallButtonStyleInterface = {
           videoCallIconTint: "red",
           voiceCallIconTint: "red",
           backgroundColor: "#dad5f5",
       }

       return (
    	 { user &&
    	   <CometChatCallButtons
              user={user}
    		  callButtonStyle={callButtonsStyle}
     	   />
    	 }
       );
     }
    ```
  </Tab>
</Tabs>

***

The following properties are exposed by `CallButtonsStyle`:

| Property              | Description                           | Code                             |
| --------------------- | ------------------------------------- | -------------------------------- |
| **border**            | Used to set border                    | `border?: BorderStyleInterface,` |
| **borderRadius**      | Used to set border radius             | `borderRadius?: number;`         |
| **backgroundColor**   | Used to set background colour         | `background?: string;`           |
| **height**            | Used to set height                    | `height?: number` \| `string;`   |
| **width**             | Used to set width                     | `width?: number` \| `string;`    |
| **voiceCallIconTint** | Used to set voice call icon tint      | `voiceCallIconTint?: string,`    |
| **videoCallIconTint** | Used to set video call icon tint      | `videoCallIconTint?: string;`    |
| **buttonPadding**     | Used to set voice call icon text font | `buttonPadding?: number;`        |

***

### 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="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2SVOPiSpm0QEqRoz/images/effd1433-call_buttons_func_cometchat_screens-be4d647a728cf3040b43bda862d39b63.png?fit=max&auto=format&n=2SVOPiSpm0QEqRoz&q=85&s=ce93b8812cb9daa907cc7f3709e6aa6e" alt="Image" width="4498" height="1424" data-path="images/effd1433-call_buttons_func_cometchat_screens-be4d647a728cf3040b43bda862d39b63.png" />
  </Tab>

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

Here is a code snippet demonstrating how you can customize the functionality of the `Call Buttons` component.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import {CometChat} from '@cometchat/chat-sdk-react-native';
    import { CometChatCallButtons } from '@cometchat/chat-uikit-react-native';

    function App(): React.JSX.Element {

    	const [user, setUser] = useState<CometChat.User | undefined>(undefined);

        const getUser = async () => {
           const user = await CometChat.getUser('uid');
           setUser(user);
        };

    	useEffect(() => {
    	   //login
           getUser();
        }, []);

       return (
    	 { user &&
    	   <CometChatCallButtons
              user={user}
              voiceCallIconText='Intiate Video Call'
              videoCallIconText='Intiate Audio Call'
     	   />
    	 }
       );
     }
    ```
  </Tab>
</Tabs>

Below is a list of customizations along with corresponding code snippets

| Property                   | Description                                                                              | Code                                                              |
| -------------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| **group**                  | Used to set the group object for Call Buttons                                            | `group?: CometChat.Group`                                         |
| **user**                   | Sets the user object for Call Buttons                                                    | `user?: CometChat.User`                                           |
| **videoCallIconHoverText** | Used to set the custom text or tooltip displayed on the video call button on mouse over. | `videoCallIconHoverText='Your Custom Video Call Icon Hover Text'` |
| **voiceCallIconHoverText** | Used to set the custom text or tooltip displayed on the voice call button on mouse over. | `voiceCallIconHoverText='Your Custom Voice Call Icon Hover text'` |
| **voiceCallIconText**      | Used to set custom voice call icon text                                                  | `voiceCallIconText?: string`                                      |
| **videoCallIconText**      | Used to set custom video call icon text                                                  | `videoCallIconText?: string`                                      |
| **voiceCallIconImage**     | Used to set custom Icon for Video Call Button                                            | `voiceCallIconImage?: ImageType`                                  |
| **videoCallIconImage**     | Used to set custom Icon for Voice Call Button                                            | `videoCallIconImage?: ImageType`                                  |
| **hideVoiceCall**          | Used to hide Voice Call                                                                  | \`hideVoiceCall?: boolean                                         |
| **hideVideoCall**          | Used to hide Video Call                                                                  | \`hideVideoCall?: boolean                                         |

***

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

the `Call Buttons` component does not offer any advanced functionalities beyond this level of customization.

***
