Data table
A sortable, paginated grid of rows and columns, for datasets larger than the plain table block handles.
data_table renders a grid with a header row, per-column sorting, and pagination once a table has
more than a handful of rows. It isn’t part of the public @slack/types package, so treat this page’s
field list as the reference.
Fields
typestring
Always `data_table`.
stringcaption?string
Shown above the table and used to label the expand control.
stringrowsCell[][]
The grid, header row first. `rows[0]` is the header and `rows.length - 1` sets the column count; every subsequent row is a data row.
Cell[][]Cell
Each cell is one of four shapes, picked by type:
raw_text?{ type: "raw_text", text: string }
Plain text, sorted alphabetically.
{ type: "raw_text", text: string }raw_number?{ type: "raw_number", value: number, text: string }
A number with its own display text. Sorts numerically by `value`, displays `text`.
{ type: "raw_number", value: number, text: string }url?{ type: "url", url: string, text?: string }
A link, opened in a new tab. `text` defaults to the raw URL.
{ type: "url", url: string, text?: string }rich_text?RichTextBlock
A Slack rich text node: bold, italic, and other inline styles.
RichTextBlockExamples
Basic table
The preview above is fixtures/catalog/table/basic-data-table.json, a mix of raw_text and
rich_text cells.
Numeric sorting
raw_number cells sort by their numeric value, not by the formatted text, so $8,500 sorts below
$42,000 even though "$120,000" would sort first alphabetically.
Pagination
Add more than 5 data rows and page controls appear automatically: