> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-agent-in-group-react-v6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Reactions

> Reactions — CometChat documentation.

## Overview

The `CometChatReactions` component provides a visual representation of emoji reactions associated with a specific message. It enables users to quickly identify which emojis were used to react to the message and by whom.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/k82rLv-mRy38q-bk/images/e6cb5371-reaction_overview_web_screens-06d1ef89b7b7416238f342e7b8546bcc.png?fit=max&auto=format&n=k82rLv-mRy38q-bk&q=85&s=aef1a8a6bd9f6e9fef481dfd42326893" width="3600" height="2400" data-path="images/e6cb5371-reaction_overview_web_screens-06d1ef89b7b7416238f342e7b8546bcc.png" />
</Frame>

## Usage

### Integration

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

<Tabs>
  <Tab title="ReactionDemo.tsx">
    ```typescript theme={null}
    import { CometChat } from '@cometchat/chat-sdk-javascript';
    import { CometChatReactions, ReactionsStyle } from '@cometchat/chat-uikit-react'
    import React from 'react'
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
        const [message, setmessage] = React.useState<CometChat.BaseMessage | undefined>();

        React.useEffect(() => {
            CometChat.getMessageDetails(message-id).then((message) => {
                setmessage(message);
            })
        }, []);

        const CometChatReaction = createComponent({
            tagName: "cometchat-reactions",
            elementClass: CometChatReactions,
            react: React,
          });
        const reactionsStyle = new ReactionsStyle({
            background:'#b067f5',
            border:'2px solid #881ced',
            borderRadius:'20px',
            width:'170px',
          });
        return (
            <>
                {
                    message &&
                    <CometChatReaction
                    messageObject={message}
                    reactionsStyle={reactionsStyle}
                    />
                }
            </>
        )
    }

    export default ReactionDemo;
    ```
  </Tab>

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

    export default function App() {
      return (
        <div className="App">
          <div>
            <ReactionDemo />
          </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. reactionClick

`reactionClick` is triggered when you click on each Reaction in the footer view of message bubble. You can override this action using the following code snippet.

```
reactionClick = { onReactionClick };
```

**Example**

In this example, we are employing the `reactionClick` action.

<Tabs>
  <Tab title="TypeScript">
    ReactionDemo.tsx

    ```typescript theme={null}
    import { CometChat } from '@cometchat/chat-sdk-javascript';
    import { CometChatReactions, ReactionsStyle } from '@cometchat/chat-uikit-react'
    import React from 'react'
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
        const [message, setMessage] = React.useState<CometChat.BaseMessage | undefined>();

        React.useEffect(() => {
            CometChat.getMessageDetails(message-id).then((message) => {
                setMessage(message);
            })
        }, []);

        const CometChatReaction = createComponent({
            tagName: "cometchat-reactions",
            elementClass: CometChatReactions,
            react: React,
          });
        function onReactionClick(reaction: CometChat.ReactionCount, message: CometChat.BaseMessage): void {
            console.log("Your Custom Reaction Click actions");
        }
        return (
            <>
                {
                    message &&
                    <CometChatReaction
                    messageObject={message}
                    reactionClick={onReactionClick}
                    />
                }
            </>
        )
    }

    export default ReactionDemo;
    ```
  </Tab>

  <Tab title="JavaScript">
    ReactionDemo.jsx

    ```javascript theme={null}
    import { CometChat } from "@cometchat/chat-sdk-javascript";
    import {
      CometChatReactions,
      ReactionsStyle,
    } from "@cometchat/chat-uikit-react";
    import React, { useState, useEffect } from "react";
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
      const [message, setMessage] = useState();

      useEffect(() => {
        CometChat.getMessageDetails("message-id").then((message) => {
          setMessage(message);
        });
      }, []);

      const CometChatReaction = createComponent({
        tagName: "cometchat-reactions",
        elementClass: CometChatReactions,
        react: React,
      });

      function onReactionClick(reaction, message) {
        console.log("Your Custom Reaction Click actions");
      }

      return (
        <>
          {message && (
            <CometChatReaction
              messageObject={message}
              reactionClick={onReactionClick}
            />
          )}
        </>
      );
    };

    export default ReactionDemo;
    ```
  </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 `Reactions` component does not have any exposed filters.

### 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 `Reactions` component does not produce any events.

## Customization

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

To customize the appearance, you can assign a `reactionsStyle` object to the `Reactions` component.

**Example**

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

<Tabs>
  <Tab title="TypeScript">
    ReactionDemo.tsx

    ```typescript theme={null}
    import { CometChat } from '@cometchat/chat-sdk-javascript';
    import { CometChatReactions, ReactionsStyle } from '@cometchat/chat-uikit-react'
    import React from 'react'
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
        const [message, setMessage] = React.useState<CometChat.BaseMessage | undefined>();

        React.useEffect(() => {
            CometChat.getMessageDetails(message-id).then((message) => {
                setMessage(message);
            })
        }, []);

        const CometChatReaction = createComponent({
            tagName: "cometchat-reactions",
            elementClass: CometChatReactions,
            react: React,
          });
        const reactionsStyle = new ReactionsStyle({
            background:'#b067f5',
            border:'2px solid #881ced',
            borderRadius:'20px',
            width:'170px',
          });
        return (
            <>
                {
                    message &&
                    <CometChatReaction
                    messageObject={message}
                    reactionsStyle={reactionsStyle}
                    />
                }
            </>
        )
    }

    export default ReactionDemo;
    ```
  </Tab>

  <Tab title="JavaScript">
    ReactionDemo.jsx

    ```javascript theme={null}
    import { CometChat } from "@cometchat/chat-sdk-javascript";
    import {
      CometChatReactions,
      ReactionsStyle,
    } from "@cometchat/chat-uikit-react";
    import React, { useState, useEffect } from "react";
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
      const [message, setMessage] = useState();

      useEffect(() => {
        CometChat.getMessageDetails("message-id").then((message) => {
          setMessage(message);
        });
      }, []);

      const CometChatReaction = createComponent({
        tagName: "cometchat-reactions",
        elementClass: CometChatReactions,
        react: React,
      });

      const reactionsStyle = new ReactionsStyle({
        background: "#b067f5",
        border: "2px solid #881ced",
        borderRadius: "20px",
        width: "170px",
      });

      return (
        <>
          {message && (
            <CometChatReaction
              messageObject={message}
              reactionsStyle={reactionsStyle}
            />
          )}
        </>
      );
    };

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

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/-MogY9MW_bOB3epD/images/4ecd8969-reactions_style_web_screens-71c6be54bd1ac5e6a62be3f2b9ae380f.png?fit=max&auto=format&n=-MogY9MW_bOB3epD&q=85&s=84dfd0c6df74684581f14efc38b1f2e2" width="3600" height="2400" data-path="images/4ecd8969-reactions_style_web_screens-71c6be54bd1ac5e6a62be3f2b9ae380f.png" />
</Frame>

List of properties exposed by ReactionsStyle

| Property                         | Description                                 | Code                                     |
| -------------------------------- | ------------------------------------------- | ---------------------------------------- |
| **border**                       | Used to set border                          | `border?: string,`                       |
| **borderRadius**                 | Used to set border radius                   | `borderRadius?: string;`                 |
| **background**                   | Used to set background colour               | `background?: string;`                   |
| **height**                       | Used to set height                          | `height?: string;`                       |
| **width**                        | Used to set width                           | `width?: string;`                        |
| **barPadding**                   | used to set the bar padding                 | `barPadding?: string;`                   |
| **reactionBoxShadow**            | used to set the reactions box-shadow        | `reactionBoxShadow?: string;`            |
| **reactionBorderRadius**         | used to set the reactions border radius     | `reactionBorderRadius?: string;`         |
| **reactionBorder**               | used to set the reactions border            | `reactionBorder?: string;`               |
| **reactionBackground**           | used to set the reactions background        | `reactionBackground?: string;`           |
| **activeReactionBorder**         | used to set the active reactions border     | `activeReactionBorder?: string;`         |
| **activeReactionBackground**     | used to set the active reactions background | `activeReactionBackground?: string;`     |
| **reactionEmojiFont**            | used to set the reaction emoji text font    | `reactionEmojiFont?: string;`            |
| **reactionCountTextFont**        | used to set the reaction count text font    | `reactionCountTextFont?: string;`        |
| **reactionCountTextColor**       | used to set the reaction count text color   | `reactionCountTextColor?: string;`       |
| **activeReactionCountTextFont**  | used to set the active reaction text font   | `activeReactionCountTextFont?: string;`  |
| **activeReactionCountTextColor** | used to set the active reaction text color  | `activeReactionCountTextColor?: string;` |
| **baseReactionBackground**       | used to set the base reaction background    | `baseReactionBackground?: string;`       |

***

### 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="TypeScript">
    ReactionDemo.tsx

    ```typescript theme={null}
    import { CometChat } from '@cometchat/chat-sdk-javascript';
    import { CometChatReactions, MessageBubbleAlignment } from '@cometchat/chat-uikit-react'
    import React from 'react'
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
        const [message, setMessage] = React.useState<CometChat.BaseMessage | undefined>();

        React.useEffect(() => {
            CometChat.getMessageDetails(message-id).then((message) => {
                setMessage(message);
            })
        }, []);

        const CometChatReaction = createComponent({
            tagName: "cometchat-reactions",
            elementClass: CometChatReactions,
            react: React,
          });

        return (
            <>
                {
                    message &&
                    <CometChatReaction
                    messageObject={message}
                    alignment={MessageBubbleAlignment.right}
                    hoverDebounceTime={100}
                    />
                }
            </>
        )
    }

    export default ReactionDemo;
    ```
  </Tab>

  <Tab title="JavaScript">
    ReactionDemo.jsx

    ```javascript theme={null}
    import { CometChat } from "@cometchat/chat-sdk-javascript";
    import {
      CometChatReactions,
      MessageBubbleAlignment,
    } from "@cometchat/chat-uikit-react";
    import React, { useState, useEffect } from "react";
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
      const [message, setMessage] = useState();

      useEffect(() => {
        CometChat.getMessageDetails("message-id").then((message) => {
          setMessage(message);
        });
      }, []);

      const CometChatReaction = createComponent({
        tagName: "cometchat-reactions",
        elementClass: CometChatReactions,
        react: React,
      });

      return (
        <>
          {message && (
            <CometChatReaction
              messageObject={message}
              alignment={MessageBubbleAlignment.right}
              hoverDebounceTime={100}
            />
          )}
        </>
      );
    };

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

***

Below is a customizations list along with corresponding code snippets

| Property                         | Description                                                                                            | Code                                       |
| -------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------ |
| **alignment** [report]()         | Used to set the allignment of the reactions. it can be either **left**, **right** or **center**        | `alignment={MessageBubbleAlignment.right}` |
| **hoverDebounceTime** [report]() | Used to sets the delay before displaying the tooltip reaction information when hovering over reactions | `hoverDebounceTime={100}`                  |

## Configuration

[Configurations](/ui-kit/react/v4/components-overview#configurations) offer the ability to customize the properties of each component within a Composite Component.

### Reaction Info

If you want to customize the properties of the [Reaction Info](/ui-kit/react/v4/reaction-info) Component inside Reactions Component, you need use the `reactionInfoConfiguration` object.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/JoK2O2F7IYCQF1_g/images/22225260-reaction_info_Configuration_web_screens-a1a96edb322c1efaf4ff5a5c612738c6.png?fit=max&auto=format&n=JoK2O2F7IYCQF1_g&q=85&s=fb0a3aa7e9817a8e7b1224e7bdfc2208" width="3600" height="2400" data-path="images/22225260-reaction_info_Configuration_web_screens-a1a96edb322c1efaf4ff5a5c612738c6.png" />
</Frame>

<Tabs>
  <Tab title="TypeScript">
    ReactionDemo.tsx

    ```typescript theme={null}
    import { CometChat } from '@cometchat/chat-sdk-javascript';
    import { CometChatReactions, ReactionInfoConfiguration, ReactionInfoStyle } from '@cometchat/chat-uikit-react'
    import React from 'react'
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
        const [message, setMessage] = React.useState<CometChat.BaseMessage | undefined>();

        React.useEffect(() => {
            CometChat.getMessageDetails(message-id).then((message) => {
                setMessage(message);
            })
        }, []);

        const CometChatReaction = createComponent({
            tagName: "cometchat-reactions",
            elementClass: CometChatReactions,
            react: React,
          });

        const reactionInfoStyle = new ReactionInfoStyle({
            background:'#631aeb',
            borderRadius:'20px'
        })
        const reactionInfoConfiguration = new ReactionInfoConfiguration({
            reactionInfoStyle:reactionInfoStyle
            //properties of reaction info
        });

        return (
            <>
                {
                    message &&
                    <CometChatReaction
                    messageObject={message}
                    reactionInfoConfiguration={reactionInfoConfiguration}
                    />
                }
            </>
        )
    }

    export default ReactionDemo;
    ```
  </Tab>

  <Tab title="JavaScript">
    ReactionDemo.jsx

    ```javascript theme={null}
    import { CometChat } from "@cometchat/chat-sdk-javascript";
    import {
      CometChatReactions,
      ReactionInfoConfiguration,
      ReactionInfoStyle,
    } from "@cometchat/chat-uikit-react";
    import React, { useState, useEffect } from "react";
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
      const [message, setMessage] = useState();

      useEffect(() => {
        CometChat.getMessageDetails("message-id").then((message) => {
          setMessage(message);
        });
      }, []);

      const CometChatReaction = createComponent({
        tagName: "cometchat-reactions",
        elementClass: CometChatReactions,
        react: React,
      });

      const reactionInfoStyle = new ReactionInfoStyle({
        background: "#631aeb",
        borderRadius: "20px",
      });

      const reactionInfoConfiguration = new ReactionInfoConfiguration({
        reactionInfoStyle: reactionInfoStyle,
        // Add other properties of reaction info as needed
      });

      return (
        <>
          {message && (
            <CometChatReaction
              messageObject={message}
              reactionInfoConfiguration={reactionInfoConfiguration}
            />
          )}
        </>
      );
    };

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

The `reactionInfoConfiguration` indeed provides access to all the [Action](/ui-kit/react/v4/reaction-info#actions), [Filters](/ui-kit/react/v4/reaction-info#filters), [Styles](/ui-kit/react/v4/reaction-info#style), [Functionality](/ui-kit/react/v4/reaction-info#functionality), and [Advanced](/ui-kit/react/v4/reaction-info#functionality) properties of the [Reaction Info](/ui-kit/react/v4/reaction-info) component.

In the above example, we are styling a few properties of the [Reaction Info](/ui-kit/react/v4/reaction-info) component using `reactionInfoConfiguration`.

### Reaction List

If you want to customize the properties of the [Reaction List](/ui-kit/react/v4/reaction-list) Component inside Reactions Component, you need use the `reactionListConfiguration` object.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/aRTT1Z3XQ9tvRy7f/images/124297fa-reaction_list_configuration_web_screens-b18fe84f0afb8472db5bacec2cb3110a.png?fit=max&auto=format&n=aRTT1Z3XQ9tvRy7f&q=85&s=e0eca2ec7d971b8e54a9bb489cada468" width="3600" height="2400" data-path="images/124297fa-reaction_list_configuration_web_screens-b18fe84f0afb8472db5bacec2cb3110a.png" />
</Frame>

<Tabs>
  <Tab title="TypeScript">
    ReactionDemo.tsx

    ```typescript theme={null}
    import { CometChat } from '@cometchat/chat-sdk-javascript';
    import { CometChatReactions, ReactionListConfiguration, ReactionListStyle } from '@cometchat/chat-uikit-react'
    import React from 'react'
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
        const [message, setMessage] = React.useState<CometChat.BaseMessage | undefined>();

        React.useEffect(() => {
            CometChat.getMessageDetails(message-id).then((message) => {
                setMessage(message);
            })
        }, []);

        const CometChatReaction = createComponent({
            tagName: "cometchat-reactions",
            elementClass: CometChatReactions,
            react: React,
          });

        const reactionListStyle = new ReactionListStyle({
            background:'#631aeb',
            border:'2px solid #881ced'
        })

        return (
            <>
                {
                    message &&
                    <CometChatReaction
                    messageObject={message}
                    reactionListConfiguration={new ReactionListConfiguration({
                        reactionListStyle: reactionListStyle
                        //properties of reaction list
                    })}
                    />
                }
            </>
        )
    }

    export default ReactionDemo;
    ```
  </Tab>

  <Tab title="JavaScript">
    ReactionDemo.jsx

    ```javascript theme={null}
    import { CometChat } from "@cometchat/chat-sdk-javascript";
    import {
      CometChatReactions,
      ReactionListConfiguration,
      ReactionListStyle,
    } from "@cometchat/chat-uikit-react";
    import React, { useState, useEffect } from "react";
    import { createComponent } from "@lit-labs/react";

    const ReactionDemo = () => {
      const [message, setMessage] = useState();

      useEffect(() => {
        CometChat.getMessageDetails("message-id").then((message) => {
          setMessage(message);
        });
      }, []);

      const CometChatReaction = createComponent({
        tagName: "cometchat-reactions",
        elementClass: CometChatReactions,
        react: React,
      });

      const reactionListStyle = new ReactionListStyle({
        background: "#631aeb",
        border: "2px solid #881ced",
      });

      return (
        <>
          {message && (
            <CometChatReaction
              messageObject={message}
              reactionListConfiguration={
                new ReactionListConfiguration({
                  reactionListStyle: reactionListStyle,
                  // Add other properties of reaction list as needed
                })
              }
            />
          )}
        </>
      );
    };

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

The `reactionListConfiguration` indeed provides access to all the [Action](/ui-kit/react/v4/reaction-list#actions), [Filters](/ui-kit/react/v4/reaction-list#filters), [Styles](/ui-kit/react/v4/reaction-list#style), [Functionality](/ui-kit/react/v4/reaction-list#functionality), and [Advanced](/ui-kit/react/v4/reaction-list#functionality) properties of the [Reaction List](/ui-kit/react/v4/reaction-list) component.

In the above example, we are styling a few properties of the [Reaction List](/ui-kit/react/v4/reaction-list) component using `reactionListConfiguration`.
