Aliases
data table
components / table
Product-grade data table with sorting, selection, sticky headers, and overflow-first responsiveness.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Sort launches, keep the header pinned, and review people who still need handoff.
| Apollo | Nina | Ready | Apr 16 | |
| Linen | Mara | Blocked | Apr 22 | |
| Zephyr | Rafi | Queued | Apr 18 |
Overview
This section explains the intent of the component before the implementation details.
Aliases
data table
Explore the math
Layout and Composition,Contrast and Distinctness,Proof System
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
scroll container
shellHorizontal overflow shell for narrow viewports.
table header row
headerColumn labels and sort affordances.
data row
rowSingle record in the table body.
data cell
cellSingle value within a row.
optional checkbox column
selectionSelect-all and row-selection affordances.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
columns | TableColumn[] | — | Column definitions including label, alignment, and sortability. |
rows | TableRow[] | — | Data rows, each with a stable `id`. |
caption | string | — | Visible caption describing the table. |
description | string | — | Optional supporting description for the table context. |
size | 'sm' | 'md' | 'md' | Chooses the table density recipe. |
selectable | boolean | false | Shows row selection affordances. |
sortable | boolean | false | Enables sortable headers. |
stickyHeader | boolean | false | Pins the header inside the scroll shell. |
sortBy | string | — | Controlled active sort column key. |
sortDirection | 'asc' | 'desc' | 'asc' | Controlled sort direction. |
selectedRowIds | string[] | — | Controlled selected row ids. |
emptyTitle | string | — | Heading for the empty state inside the table shell. |
emptyDescription | string | — | Supporting empty-state copy. |
onSortChange | (detail: { sortBy: string; sortDirection: "asc" | "desc" }) => void | — | Callback fired when sorting changes. |
onSelectionChange | (detail: { ids: string[] }) => void | — | Callback fired when row selection changes. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Events
| Name | Payload | Description |
|---|---|---|
sortchange | { sortBy: string; sortDirection: "asc" | "desc" } | Fires when sorting changes. |
selectionchange | { ids: string[] } | Fires when row selection changes. |
Slots
| Name | Description |
|---|---|
default | Table is data-driven in v1 and does not expose cell or row slots. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: sortable release listA standard product data table with sortable headers.
Copy snippet
<Table caption="Release schedule" columns={releaseColumns} rows={releaseRows} sortable={true} stickyHeader={true} />Common patterns
1 example
common
Common: selectable rosterSelection affordances support bulk or grouped action flows.
Copy snippet
<Table caption="Launch support roster" columns={teamColumns} rows={teamRows} selectable={true} sortable={true} selectedRowIds={['team-a', 'team-c']} />Edge cases
1 example
edge
Edge: calm empty stateThe table shell can stay honest even when there are no rows to show.
Copy snippet
<Table caption="Incidents" columns={teamColumns} rows={[]} emptyTitle="No incidents open" emptyDescription="Everything is stable right now." />Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
size=md
size=sm
size=md