Section block
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.
Fields
Field | Type | Description | Required? |
---|---|---|---|
type | String | The type of block. For a section block, type will always be section . | Required |
text | Object | The text for the block, in the form of a text object. Minimum length for the text in this field is 1 and maximum length is 3000 characters. This field is not required if a valid array of fields objects is provided instead. | Preferred |
block_id | String | A unique identifier for a block. If not specified, one will be generated. You can use this block_id when you receive an interaction payload to identify the source of the action. Maximum length for this field is 255 characters. block_id should be unique for each message and each iteration of a message. If a message is updated, use a new block_id . | Optional |
fields | Object[] | Required if no text is provided. An array of text objects. Any text objects included with fields will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10. Maximum length for the text in each item is 2000 characters. Click here for an example. | Maybe |
accessory | Object | One of the compatible element objects noted above. Be sure to confirm the desired element works with section . | Optional |
expand | Boolean | Whether or not this section block's text should always expand when rendered. If false or not provided, it may be rendered with a 'see more' option to expand and show the full text. For AI Assistant apps, this allows the app to post long messages without users needing to click 'see more' to expand the message. | Optional |
Usage info
A section
can be used as a text block, in combination with text fields, or side-by-side with certain block elements.
Examples
A text section block:
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "A message *with some bold text* and _some italicized text_."
}
}
A section block containing text fields:
{
"type": "section",
"text": {
"text": "A message *with some bold text* and _some italicized text_.",
"type": "mrkdwn"
},
"fields": [
{
"type": "mrkdwn",
"text": "High"
},
{
"type": "plain_text",
"emoji": true,
"text": "Silly"
}
]
}
A section block containing a datepicker element:
{
"type": "section",
"text": {
"text": "*Haley* has requested you set a deadline for finding a house",
"type": "mrkdwn"
},
"accessory": {
"type": "datepicker",
"action_id": "datepicker123",
"initial_date": "1990-04-28",
"placeholder": {
"type": "plain_text",
"text": "Select a date"
}
}
}