Reference: Composition objects

Composition objects can be used inside of block elements and certain message payload fields. They are simply common JSON object patterns that you'll encounter frequently when building blocks or composing messages.

Our guide to Block Kit in app surfaces shows you where you can use blocks.

The lists of fields and values below describe the JSON that apps can use to generate each object:


Text object

An object containing some text, formatted either as plain_text or using mrkdwn, our proprietary textual markup that's just different enough from Markdown to frustrate you.

Fields

Field Type Required? Description
type String Yes The formatting to use for this text object. Can be one of plain_textor mrkdwn.
text String Yes The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.
emoji Boolean No Indicates whether emojis in a text field should be escaped into the colon emoji format. This field is only usable when type is plain_text.
verbatim Boolean No When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed.
Using a value of true will skip any preprocessing of this nature, although you can still include manual parsing strings. This field is only usable when type is mrkdwn.

Example

{
  "type": "mrkdwn",
  "text": "A message *with some bold text* and _some italicized text_."
}

View an example


Confirmation dialog object

An object that defines a dialog that provides a confirmation step to any interactive element. This dialog will ask the user to confirm their action by offering a confirm and deny buttons.

Fields

Field Type Required? Description
title Object Yes A plain_text-only text object that defines the dialog's title. Maximum length for this field is 100 characters.
text Object Yes A text object that defines the explanatory text that appears in the confirm dialog. Maximum length for the text in this field is 300 characters.
confirm Object Yes A plain_text-only text object to define the text of the button that confirms the action. Maximum length for the text in this field is 30 characters.
deny Object Yes A plain_text-only text object to define the text of the button that cancels the action. Maximum length for the text in this field is 30 characters.
style String No Defines the color scheme applied to the confirm button. A value of danger will display the button with a red background on desktop, or red text on mobile. A value of primary will display the button with a green background on desktop, or blue text on mobile. If this field is not provided, the default value will be primary.

Example

{
  "title": {
      "type": "plain_text",
      "text": "Are you sure?"
  },
  "text": {
      "type": "mrkdwn",
      "text": "Wouldn't you prefer a good game of _chess_?"
  },
  "confirm": {
      "type": "plain_text",
      "text": "Do it"
  },
  "deny": {
      "type": "plain_text",
      "text": "Stop, I've changed my mind!"
  }
}

View an example


Option object

An object that represents a single selectable item in a select menu, multi-select menu, checkbox group, radio button group, or overflow menu.

Fields

Field Type Required? Description
text Object Yes A text object that defines the text shown in the option on the menu. Overflow, select, and multi-select menus can only use plain_text objects, while radio buttons and checkboxes can use mrkdwn text objects. Maximum length for the text in this field is 75 characters.
value String Yes The string value that will be passed to your app when this option is chosen. Maximum length for this field is 75 characters.
description Object No A plain_text only text object that defines a line of descriptive text shown below the text field beside the radio button. Maximum length for the text object within this field is 75 characters.
url String No A URL to load in the user's browser when the option is clicked. The url attribute is only available in overflow menus. Maximum length for this field is 3000 characters. If you're using url, you'll still receive an interaction payload and will need to send an acknowledgement response.

Example

{
    "text": {
        "type": "plain_text",
        "text": "Maru"
    },
    "value": "maru"
}

View an example


Option group object

Provides a way to group options in a select menu or multi-select menu.

Fields

Field Type Required? Description
label Object Yes A plain_text only text object that defines the label shown above this group of options. Maximum length for the text in this field is 75 characters.
options Object[] Yes An array of option objects that belong to this specific group. Maximum of 100 items.

Example

"option_groups": [
  {
    "label": {
      "type": "plain_text",
      "text": "Group 1"
    },
    "options": [
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-0"
      },
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-1"
      },
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-2"
      }
    ]
  },
  {
    "label": {
        "type": "plain_text",
        "text": "Group 2"
    },
    "options": [
      {
        "text": {
            "type": "plain_text",
            "text": "*this is plain_text text*"
        },
        "value": "value-3"
      }
    ]
  }
]

View an example


Filter object for conversation lists

Provides a way to filter the list of options in a conversations select menu or conversations multi-select menu.

Fields

Field Type Required? Description
include String[] No Indicates which type of conversations should be included in the list. When this field is provided, any conversations that do not match will be excluded

You should provide an array of strings from the following options: im, mpim, private, and public. The array cannot be empty.
exclude_external_shared_channels Boolean No Indicates whether to exclude external shared channels from conversation lists. Defaults to false.
exclude_bot_users Boolean No Indicates whether to exclude bot users from conversation lists. Defaults to false.

Please note that while none of the fields above are individually required, you must supply at least one of these fields.

Example

{
  "type": "conversations_select",
  "placeholder": {
    "type": "plain_text",
    "text": "Select a conversation",
    "emoji": true
  },
  "filter": {
    "include": [
      "public",
      "mpim"
    ],
    "exclude_bot_users" : true
  } 
}

View an example

Known issues

  • In iOS, the placeholder text is replaced with "0 selected" when there are no selected conversations.

  • In iOS, there are UI inconsistencies when users select items in multi-select menus.