Checkboxes element
Welcome to the new home of Slack developer docs!
We're still building and not all features are available quite yet. Enjoy this peek into the future!
Not ready for the future? Return to the past at api.slack.com.
Example:
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of element. In this case type is always checkboxes . | Required |
action_id | String | An identifier for the action triggered when the checkbox group is changed. 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. | Optional |
options | Object[] | An array of option objects. A maximum of 10 options are allowed. | Required |
initial_options | Object[] | An array of option objects that exactly matches one or more of the options within options . These options will be selected when the checkbox group initially loads. | Optional |
confirm | Object | A confirm object that defines an optional confirmation dialog that appears after clicking one of the checkboxes in this element. | Optional |
focus_on_load | Boolean | Indicates whether the element will be set to auto focus within the view object . Only one element can be set to true . Defaults to false . | Optional |
Example
A section block containing a group of checkboxes:
{
"type": "modal",
"title": {
"type": "plain_text",
"text": "My App",
"emoji": true
},
"submit": {
"type": "plain_text",
"text": "Submit",
"emoji": true
},
"close": {
"type": "plain_text",
"text": "Cancel",
"emoji": true
},
"blocks": [
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Check out these charming checkboxes"
},
"accessory": {
"type": "checkboxes",
"action_id": "this_is_an_action_id",
"initial_options": [{
"value": "A1",
"text": {
"type": "plain_text",
"text": "Checkbox 1"
}
}],
"options": [
{
"value": "A1",
"text": {
"type": "plain_text",
"text": "Checkbox 1"
}
},
{
"value": "A2",
"text": {
"type": "plain_text",
"text": "Checkbox 2"
},
"description": {
"type": "mrkdwn",
"text": "*A description of option two*"
},
}
]
}
}
]
}