# Icon button element

A small button that shows an icon instead of text.

| | |
|---|---|
| **Type** | `icon_button` |
| **Available in** | Messages |
| **Works in blocks** | [Context actions block](https://workstation.repzo.com/docs/developers/block-kit/blocks/context-actions-block) |

## Usage

Clicking it sends your app a `block_actions` payload:

```json
{
  "type": "icon_button",
  "action_id": "delete_reminder",
  "block_id": "reminder_r88",
  "value": "R-88",
  "action_ts": "1793786400.000000"
}
```

See the [button element](https://workstation.repzo.com/docs/developers/block-kit/elements/button-element) for the rest of the payload.

## Fields

| Field | Type | Description | Required? |
|---|---|---|---|
| `type` | String | The type of element. In this case `type` is always `icon_button`. | Required |
| `icon` | String | The icon to show. The `trash` icon is the only icon available at this time. | Required |
| `text` | [Text object](https://workstation.repzo.com/docs/developers/block-kit/objects/text-object) | A text object that defines the button's text, shown as its tooltip. Can only be of `type: plain_text`. Maximum length for the `text` in this field is 75 characters. | Required |
| `action_id` | String | An identifier for the action triggered when the button is clicked. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other `action_id`s in the containing block. Maximum length is 255 characters. If you leave it out, Repzo generates one. | Optional |
| `value` | String | The value to send along with the interaction payload. Maximum length is 2000 characters. | Optional |
| `confirm` | [Confirmation dialog object](https://workstation.repzo.com/docs/developers/block-kit/objects/confirmation-dialog-object) | A confirm object that defines an optional confirmation dialog that appears after the button is clicked. If the reader cancels, nothing is sent to your app. | Optional |
| `accessibility_label` | String | A label for longer descriptive text about the button. This label will be read out by screen readers _instead of_ the button `text` object. Maximum length is 75 characters. | Optional |

> **How Repzo Chat differs from Slack**
>
> - `visible_to_user_ids` isn't supported: everyone sees the button.

## Examples

### A delete button with a confirmation

```json
{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "Reminder: send the revised quote to *Contoso Clinics* on Thursday at 09:00."
      }
    },
    {
      "type": "context_actions",
      "block_id": "reminder_r88",
      "elements": [
        {
          "type": "icon_button",
          "icon": "trash",
          "action_id": "delete_reminder",
          "text": {
            "type": "plain_text",
            "text": "Delete reminder"
          },
          "value": "R-88",
          "confirm": {
            "title": {
              "type": "plain_text",
              "text": "Delete this reminder?"
            },
            "text": {
              "type": "plain_text",
              "text": "You won't be reminded about this quote."
            },
            "confirm": {
              "type": "plain_text",
              "text": "Delete"
            },
            "deny": {
              "type": "plain_text",
              "text": "Keep"
            },
            "style": "danger"
          }
        }
      ]
    }
  ]
}
```

## Related

- [Block elements](https://workstation.repzo.com/docs/developers/block-kit/elements)
- [Block Kit overview](https://workstation.repzo.com/docs/developers/block-kit)
