# Comment

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-2a45a1a725292adc87a46bdadd6eaadcbce66dff%2Fimage%20(79).png?alt=media" alt=""><figcaption></figcaption></figure>

## Basic

#### Title

Enter the text to be shown as the title at the top of the chat box. It is recommended to keep this string short and contextual.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-798e09ecade53c396a7e1c99ca5a00bac6115612%2Fimage%20(80).png?alt=media" alt=""><figcaption></figcaption></figure>

## Data

#### Comment List Data

Provide the data or the source for loading the content of the widget. This is technically the list of comments and other details for the entries. It can be fetched using a query from a data source.

```json
[
  {
    "user": {
      "name": "Li Lei",
      "avatar": "https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
    },
    "value": "What is the use of this component?",
    "createdAt": "2023-06-15T08:40:41.658Z"
  },
  {
    "user": {
      "name": "mou"
    },
    "value": "This component allows you to post or delete comments, as well as mention people who appear in the chat.",
    "createdAt": "2023-06-16T08:43:42.658Z"
  },
  {
    "user": {
      "name": "Han Meimei",
      "displayName": "Han"
    },
    "value": "I want to give it a try",
    "createdAt": "2023-06-17T08:49:01.658Z"
  },
  {
    "user": {
      "name": "mou"
    },
    "value": "Enter the content in the input box below and press shift+enter to send it immediately",
    "createdAt": "2023-06-18T08:50:11.658Z"
  }
]
```

| Property   | Description                                     |
| ---------- | ----------------------------------------------- |
| **`user`** |                                                 |
| name       | The name of the user who posted the comment     |
| avatar     | The URL to the profile picture of the user      |
| value      | The actual comment text submitted               |
| createdAt  | The timestamp value when the comment was posted |
|            |                                                 |

#### User Info

Mention the basic information about the user account that is to be used to post the comment. This content can be fetched using a query.

| Property | Description                                                           |
| -------- | --------------------------------------------------------------------- |
| name     | The text to be shown as the name of the user                          |
| email    | The email address of the account by which the comment is to be posted |

#### Mention List Data

Enter the JSON data that contains the users to be displayed as a list when the key '@' is pressed to tag someone. This data contains the list of hashtags shown when the user presses the '#' key.

```json
{
  "@": [
    "Li Lei",
    "Han Meimei"
  ],
  "#": [
    "friends",
    "family",
    "lifestyle",
    "happybirthday",
    "enjoyed",
    "poor",
    "fun"
  ]
}
```

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-94824d8ec0aeae52641f2fed8a4e5c9273004ddf%2Fimage%20(78).png?alt=media" alt=""><figcaption></figcaption></figure>

## Interaction

#### Event Handlers

| Event                                          | Description                                                                                                                                                                                                                                                                                                                   |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <mark style="color:blue;">**`Click`**</mark>   | <p>This event will be triggered when the user clicks inside the header portion of a comment.<br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-e03606ebaa039ac4c6aa3cec8eb669615ef08ed5%2Fimage%20(203).png?alt=media" alt=""></p> |
| <mark style="color:blue;">**`Submit`**</mark>  | <p>This event will be triggered when the user submits a comment.<br><br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-2870ab067617e4fea300b5ec6f435e2e08bcabaa%2Fimage%20(81).png?alt=media" alt=""></p>                          |
| <mark style="color:blue;">**`Delete`**</mark>  | <p>This event will be triggered when the user removes a comment.<br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-6df3cf5cb2a7a1360c16aa6f5144abc8cba2511b%2Fimage%20(82).png?alt=media" alt=""></p>                              |
| <mark style="color:blue;">**`Mention`**</mark> | <p>This event will be triggered when a user is mentioned in a post.<br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-6fa743094ed804aeaa04ad7c12ce1d3f8f9894a5%2Fimage%20(83).png?alt=media" alt=""></p>                           |

#### Disabled

Disables the user interaction with the element on the page. It visually indicates that the element is inactive and prevents users from interacting with it when applied.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-695f356d5e8bc58072102f50922157508eb6122b%2Fimage%20(224).png?alt=media" alt=""><figcaption><p>Read-only</p></figcaption></figure>

#### Hide

This sets whether the widget has to be displayed on the screen when the program is loaded. This shows/hides the widget both on desktop and mobile devices.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-4aaa812d0b623487c085a616219a4515138079fb%2Fimage%20(211).png?alt=media" alt="" width="338"><figcaption><p>Set the visibility</p></figcaption></figure>

#### Allowing Comments

Enables the comment box where the user can enter and submit the comments. This will be helpful if the admin needs to abstain from specific users from submitting posts.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-f91748f96d61dec6866e07cf070c1ccad41af059%2Fimage%20(84).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Show Delete Button

Displays the delete option button at the end of each comment. Allows the users to redo their submit action, or remove unwanted posts.

![](https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-c726582ba77f956a1280386aac0bc635b6916454%2Fimage%20\(85\).png?alt=media)

## Layout

#### Button Title

This is the text displayed on the submit button. Users will click this button to post their comments after typing.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-3593d9446d5dae6d7eaf0c66146b3b0859778e74%2Fimage%20(86).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Placeholder

Specifies a hint that describes the expected value. The placeholder shows the hint text in the widget when nothing is selected or entered. This text disappears as soon as a value is entered in the control.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-fb9365c7b7a616ef55e3a396131048fe460df808%2Fimage%20(87).png?alt=media" alt=""><figcaption></figcaption></figure>

## Style

<table><thead><tr><th width="218" align="center">Property</th><th>Description</th></tr></thead><tbody><tr><td align="center">Background</td><td>Users can change the colour of the text background using this property. It has all the RGB colour ranges to pick from. It is recommended to use a corresponding background colour that shows the font clearly.</td></tr><tr><td align="center">Mention Background</td><td>Set the background for the posts the user is tagged or mentioned. This helps the user to identify the posts easily.</td></tr><tr><td align="center">Text</td><td>Set the colour of the text used to show comments. Recommended to set in contrast with the background.</td></tr><tr><td align="center">Margin</td><td>This value is set in terms of "px" number which creates the space between the border and the content of the widget.</td></tr><tr><td align="center">Padding</td><td>This value is set in terms of "px" number which creates the space between the border and outer elements.</td></tr><tr><td align="center">Border Radius</td><td>This sets the radius of the widget's corners, enabling rounded corners on the widget. This value is defined in "px" terms.</td></tr><tr><td align="center">Border Width</td><td>Set the thickness of the border of the widget using this value. It is defined using "px" terms.</td></tr><tr><td align="center">Border Color</td><td>Set the colour to the border lines. The border lines will be shown only if that is enabled.</td></tr></tbody></table>
