Skip to main content

Data table block

The data table block is a rich table that supports pagination, sorting, filtering, and rich interactivity, such as opening a Work Object flexpane or clickable links in cells. This is different from the existing table block, which only supports filtering and basic interactivity.

Fields​

FieldTypeDescriptionRequired?
typeStringThe type of block. For a data table block, type is always data_table.Required
rowsArrayAn array consisting of table rows.Required
block_idStringA unique identifier for a block. If not specified, a block_id will be generated.Optional
page_sizeIntegerNumber of rows per page. Min 1, Max 100. Defaults to 5 if omitted.Optional
captionStringA caption for the table; used as the value for the HTML caption element.Required
row_header_column_indexIntegerThe 0-based index of the column that uniquely identifies each row (the row header). This column is treated as the row's primary identifier for screen readers. Defaults to 0 if omitted.Optional

Usage info​

You can use rich_text, raw_text (simple text), raw_number (numeric values), or action_cell (a button) for cell content. The first row of the table is a header, and rich_text cannot be used for header cells. You can have a minimum of 2 rows (1 regular row plus the header) and a maximum of 201 rows (200 regular rows plus the header). All rows must have the same number of values.

A single table's character count across all cells cannot exceed 20,000 characters. For action_cell cells, the button's text counts toward this limit. Additionally, the aggregate character count across all table cells for a single message cannot exceed 20,000 characters. Large tables should be broken up into separate messages.

Sorting rows by column is done alphabetically by default. If a column contains cells all of type raw_number, a numeric sort will be performed instead. You can have a minimum of 1 column and a maximum of 20 columns.

Schema for raw_text​

"properties": {
"type": {
"type": "string",
"enum": ["raw_text"]
},
"text": {
"type": "string",
"minLength": 1
}
}

Schema for raw_number​

"properties": {
"type": {
"type": "string",
"enum": ["raw_number"]
},
"value": {
"type": "number"
},
"text": {
"type": "string",
"minLength": 1
}
}

Schema for action_cell​

"properties": {
"type": {
"type": "string",
"enum": ["action_cell"]
},
"element": {
"type": "object",
"description": "A button element."
},
"fallback": {
"type": "object",
"description": "A raw_text or raw_number cell."
}
}

The element field is required and must be a button element. When a user clicks the button, your app receives a block_actions payload, the same as for buttons in other blocks. Set the button's value to identify the row so your app can tell which row was clicked.

{
"type": "action_cell",
"element": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Mark done"
},
"action_id": "mark_done",
"value": "task_123"
},
"fallback": {
"type": "raw_text",
"text": "Open"
}
}

The optional fallback field is a raw_text or raw_number cell that displays in place of the button on clients that don't support action cells.

Action cells can only be used in the data table block, not the table block. If a message containing a data table is shared or copied to another conversation, the buttons in the shared copy are disabled.

Example​

A sample data table block:

{
"blocks": [
{
"type": "data_table",
"caption": "A Fabulous Table",
"rows": [
[
{
"type": "raw_text",
"text": "Name"
},
{
"type": "raw_text",
"text": "Department"
},
{
"type": "raw_text",
"text": "Badge"
}
],
[
{
"type": "raw_text",
"text": "Data Refinement Department"
},
{
"type": "raw_text",
"text": "MDR"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Blue",
"style": {
"bold": true
}
}
]
}
]
}
],
[
{
"type": "raw_text",
"text": "Art Sourcing Department"
},
{
"type": "raw_text",
"text": "O&D"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Green"
},
{
"type": "text",
"text": "review",
"style": {
"italic": true
}
}
]
}
]
}
],
[
{
"type": "raw_text",
"text": "Wellness Department"
},
{
"type": "raw_text",
"text": "Wellness Center"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Limited",
"style": {
"bold": true
}
}
]
}
]
}
]
]
}
]
}

View in Block Kit Builder