Skip to content

feat(types): add data_table Block Kit block - #2638

Merged
zimeg merged 10 commits into
mainfrom
chore/block-kit-data-table
Sep 9, 2026
Merged

zimeg merged 10 commits into
mainfrom
chore/block-kit-data-table

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds the net-new data_table Block Kit block to @slack/types:

  • New DataTableBlock interface (type: 'data_table') with rows (required), caption (required), and optional page_size, row_header_column_index, and block_id.
  • rows cells accept an inline raw_text | raw_number | rich_text union (RawTextElement | RawNumberElement | RichTextBlock), matching the docs data-table-block cell types.
  • New RawNumberElement composition object (type: 'raw_number', value, text) for numeric, sortable cells.
  • DataTableBlock added to the KnownBlock union.

Follows the conventions of the existing TableBlock / AlertBlock / CardBlock types and their RawTextElement cell object.

Docs

https://docs.slack.dev/reference/block-kit/blocks/data-table-block

Validation

Run against the @slack/types workspace in an isolated worktree off origin/main:

  • npm test --workspace=packages/types (runs build via tsc + tsd type tests) — pass. Added happy/sad-path expectAssignable/expectError cases for DataTableBlock in packages/types/test/blocks.test-d.ts.
  • npx @biomejs/biome check on the touched files — pass (also enforced by the repo pre-commit hook across all 637 files — pass).

A changeset (.changeset/data-table-block.md, @slack/types minor) is included.

Co-Authored-By: Claude svc-devxp-claude@slack-corp.com

@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3c3194e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/types Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.12%. Comparing base (52eeb05) to head (3c3194e).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2638   +/-   ##
=======================================
  Coverage   89.12%   89.12%           
=======================================
  Files          65       65           
  Lines       10441    10441           
  Branches      482      481    -1     
=======================================
  Hits         9306     9306           
  Misses       1103     1103           
  Partials       32       32           
Flag Coverage Δ
cli-hooks 89.12% <ø> (ø)
cli-test 89.12% <ø> (ø)
logger 89.12% <ø> (ø)
oauth 89.12% <ø> (ø)
socket-mode 89.12% <ø> (ø)
web-api 89.12% <ø> (ø)
webhook 89.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

zimeg and others added 2 commits September 8, 2026 14:28
Add the `data_table` block (`DataTableBlock`) and the `raw_number` cell
composition object (`RawNumberElement`) used for numeric, sortable cells.
The block is added to the `KnownBlock` union and covered by tsd type tests.

Ref: https://docs.slack.dev/reference/block-kit/blocks/data-table-block

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The DataTableBlock.rows docstring stated a maximum of 101 rows (100 data
rows), but the Block Kit reference documents a maximum of 201 rows (a
header row plus 200 data rows). The 100 cap was the page_size maximum,
not the row maximum. Align the docstring with docs.slack.dev.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg force-pushed the chore/block-kit-data-table branch from 413eda0 to e2e26ff Compare September 8, 2026 21:28
zimeg and others added 4 commits September 8, 2026 14:46
The DataTableCell alias had a single use site and was not referenced
anywhere else, so inline the union directly on `rows` and drop the
exported helper type.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Align the DataTableBlock summary and every field @description with the
data-table-block reference page, and scope the changeset to the block
itself (link + name), each comment on a single line.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Use the reference page's exact wording ("Number of rows per page. Min
`1`, Max `100`. Defaults to `5` if omitted.").

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…tically

Place the new raw cell element pair in alphabetical order (Number
before Text) as the intended ordering for composition objects going
forward. Surrounding definitions are left untouched.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg added pkg:types applies to `@slack/types` semver:minor enhancement M-T: A feature request for new functionality labels Sep 8, 2026
@zimeg zimeg self-assigned this Sep 8, 2026
zimeg and others added 3 commits September 8, 2026 15:14
The rows field's @description had grown into the full docs Fields-table
paragraph (row/column min-max, character cap). Those are runtime API
limits, not part of the TS type contract, and the cell-type list just
restated the union already in the type. Trim to the lead sentence plus
the one type-inexpressible constraint: rich_text can't be a header cell.
Matches the terse one-sentence @description style of the sibling fields.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The docs Fields-table Description cell for `rows` is exactly "An array
consisting of table rows." The header-row / rich_text constraint lives
in the page's usage prose, not the field's Description cell, so it stays
out of the @description. Keep the SDK comment to what the docs field
description says, nothing added.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Drop the invented tails on RawNumberElement's @descriptions (display
text / DataTableBlock sorting framing on the object, "used for sorting
the column" on value) that the docs don't carry — the docs describe
raw_number minimally (numeric value; type enum; a number; text min
length 1). Mirror the terse RawTextElement sibling: an object line, a
"formatting to use for this numeric object" type line, and a bare value
line. text keeps its display-text + min-length note.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ A comment on changes near for wonderful reviewers!

Comment on lines +176 to +193
/**
* @description Defines an object containing a numeric value and its display text. Used for numeric cells in a
* {@link DataTableBlock}, allowing the column to be sorted numerically.
*/
export interface RawNumberElement {
/**
* @description The formatting to use for this object.
*/
type: 'raw_number';
/**
* @description The numeric value used for sorting the column.
*/
value: number;
/**
* @description The text used to display the value. The minimum length is 1 character.
*/
text: string;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📣 note: This addresses part of #2689 but not for the table block itself!

@zimeg zimeg added this to the types@next milestone Sep 8, 2026
@zimeg
zimeg marked this pull request as ready for review September 8, 2026 23:41
@zimeg
zimeg requested a review from a team as a code owner September 8, 2026 23:41
@zimeg

zimeg commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

🗣️ slack-samples/bolt-js-examples#112

zimeg added a commit to slackapi/java-slack-sdk that referenced this pull request Sep 9, 2026
Mirror the reviewed node SDK PR (slackapi/node-slack-sdk#2638):

- Correct the max row count: the model previously stated up to 100 data
  rows (101 including header); the reference documents 201 rows (200 data
  rows plus header). The 100 cap was page_size, not the row maximum. Drop
  the stale count from the javadoc rather than restate it.
- Align each field's javadoc with the data-table-block reference Fields
  table verbatim (rows, caption, page_size, row_header_column_index).
- Trim RawTextDataTableCell / RawNumberDataTableCell to the terse,
  docs-minimal descriptions (drop the invented sorting/formatting tails);
  document value and text per the docs.

Ref: https://docs.slack.dev/reference/block-kit/blocks/data-table-block

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg added a commit to slack-samples/bolt-java-examples that referenced this pull request Sep 9, 2026
Use the node @slack/types data_table example (slackapi/node-slack-sdk#2638)
— caption "A list of fruit and their quantities", a Fruit/Quantity header
with an Apples/raw_number(12) data row — so the SDKs demonstrate the same
payload. This also exercises the raw_number cell (and BlockCompositions.
rawNumber), which the prior docs-derived example did not.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

@srtaalej srtaalej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for bringing this block to node! LGTM 🌟

Comment on lines +179 to +192
export interface RawNumberElement {
/**
* @description The formatting to use for this numeric object.
*/
type: 'raw_number';
/**
* @description The numeric value.
*/
value: number;
/**
* @description The text used to display the value. The minimum length is 1 character.
*/
text: string;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

working great!

@zimeg

zimeg commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@srtaalej And immense thanks for reviews and motivation throughout these blocks building! Let's merge this now to include in an upcoming release.

@zimeg
zimeg merged commit abf184e into main Sep 9, 2026
12 checks passed
@zimeg
zimeg deleted the chore/block-kit-data-table branch September 9, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality pkg:types applies to `@slack/types` semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants