# Button BlockOn Addon

The purpose of this block is to display interactive buttons in documents source block (interfaceDocumentsSourceBlock).

### Usage <a href="#usage" id="usage"></a>

As shown in the example below, buttonBlockAddon blocks should be placed inside interfaceDocumentsSourceBlock blocks.

<figure><img src="https://docs.hedera.com/~gitbook/image?url=https%3A%2F%2F1556785885-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FNYWPEEAknX9Vki1yV5HY%252Fuploads%252Fgit-blob-0a32ec0c00e256dc51c7a7942959d79b41b9d009%252Fimage%2520%28677%29.png%3Falt%3Dmedia&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=d930d500&#x26;sv=2" alt=""><figcaption></figcaption></figure>

### Properties <a href="#properties" id="properties"></a>

| Property Name                    | Description                                                         | Example                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| -------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Button Name (*name*)             | The label (name) of the button as displayed to the user             | "Approve", "Reject"                                                                                                                                                                                                                                                                                                                                                                                                                         |
| UI Class (*uiClass*)             | The UI class of the button                                          | “btn-approve”, “btn-reject”, “btn-link”                                                                                                                                                                                                                                                                                                                                                                                                     |
| hideWhenDiscontinued             | Check if the button should be hidden when policy is discontinued    | Checked/Unchecked                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Dialog (*dialog)*                | Determines if a dialog should be opened after the button is clicked | true, false.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Dialog Options (*dialogOptions*) | Will be shown only if the Dialog setting is set to true.            | <p></p><ol><li>Dialog Title (<em>dialogOptions.dialogTitle</em>): The title of the dialog. Example: “Rejection”.</li><li>Dialog Description (<em>dialogOptions.dialogDescription</em>): The description of the dialog. Example: “Enter reject reason”.</li><li>Dialog Result Field Path (<em>dialogOptions.dialogResultFieldPath</em>): The field which will contain the result value from the dialog. Example: “option.comment”.</li></ol> |

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FeezfVSBn9foK4L09MQWl%2Fimage.png?alt=media&#x26;token=780d0cb4-5f01-465c-b8b9-df41520d5cb6" alt=""><figcaption></figcaption></figure>

## API <a href="#api" id="api"></a>

The API for the buttonBlockAddon features both GET and POST methods:

1. Example response to the GET request:

```
{
    "id": "4e43f63f-f2e9-4336-a69e-931ec4aafaee",
    "blockType": "buttonBlockAddon",
    "dialog": true,
    "dialogOptions": {
        "dialogTitle": "Reject",
        "dialogDescription": "Enter reject reason",
        "dialogResultFieldPath": "option.comment"
    },
    "name": "Reject",
    "uiClass": "btn-reject",
}
```

The response to the GET request includes all block settings.

1. Example payload for the POST request:

```
{
  "documentId": "66b2838927c34db3c18e3c49",
  "dialogResult": "Typo in name"
}
```

Where

documentId - selected document identifier.

dialogResult is used for the dialog only.
