Skip to content

feat(DataTable): introduce compound component over createDataTable - #825

Open
johnleider wants to merge 9 commits into
devfrom
cursor/datatable-component-shell-06e4
Open

feat(DataTable): introduce compound component over createDataTable#825
johnleider wants to merge 9 commits into
devfrom
cursor/datatable-component-shell-06e4

Conversation

@johnleider

@johnleider johnleider commented Aug 12, 2026

Copy link
Copy Markdown
Member

Closes #512
Part of #507

Summary

Implements the DataTable compound component shell for FR #512 over the existing preview composable createDataTable.

This PR ships a thin compound component layer (DataTable.*) that composes createDataTable — structural shells first, not a full feature kitchen sink. Follows house patterns from Avatar/Snackbar/existing table-related code.

Components

Component Element Role
DataTable.Root Provider wrapping createDataTable, exposes context
DataTable.Table <table> role="table", aria-rowcount
DataTable.Head <thead> Exposes 2D header grid
DataTable.HeaderRow <tr> Header row container
DataTable.HeaderCell <th> aria-sort, sort controls
DataTable.Body <tbody> Exposes paginated items
DataTable.Row <tr> Selection and expansion state
DataTable.Cell <td> colspan support
DataTable.Empty Conditional empty state row

Checklist

  • packages/0/src/components/DataTable/ with Root + essential parts
  • Context provider wired to createDataTable
  • Exports in components barrel (alphabetical order)
  • maturity.json draftpreview, since: null
  • Docs page (apps/docs/src/pages/components/data/data-table.md)
  • Basic example (apps/docs/src/examples/components/data-table/basic.vue)
  • apps/docs/src/pages/components/index.md updated
  • Browser tests (index.browser.test.ts)
  • Surface freeze update (surface.test.ts)
  • packages/0/README.md sync
  • Changeset
  • A11y fixture for accessibility sweep
  • One-shot onMounted pattern for onboard (no render side-effects)

Intentionally Deferred

  • Pagination sub-components — use existing Pagination compound component alongside DataTable
  • Selection chrome (select-all checkbox, selection toolbar) — can be composed by consumers
  • Density toggles — styling concern, out of scope for headless
  • Column resize/reorder — future enhancement
  • Sticky headers/columns — CSS styling, out of scope for headless
Open in Web Open in Cursor 

@cursor
cursor Bot force-pushed the cursor/datatable-component-shell-06e4 branch from 031639d to 7a72d38 Compare August 14, 2026 22:55
@johnleider
johnleider marked this pull request as ready for review August 14, 2026 22:59
@johnleider johnleider added this to the v1.1.0 milestone Aug 16, 2026
@johnleider johnleider self-assigned this Aug 16, 2026
cursoragent and others added 8 commits August 20, 2026 08:05
Headless compound component for rendering tabular data with semantic
table markup and ARIA support:

- DataTable.Root — provider that wraps createDataTable and exposes context
- DataTable.Table — <table> with role="table" and aria-rowcount
- DataTable.Head — <thead> exposing the 2D header grid
- DataTable.HeaderRow — <tr> for header rows
- DataTable.HeaderCell — <th> with aria-sort and sort controls
- DataTable.Body — <tbody> exposing paginated items
- DataTable.Row — <tr> with selection and expansion state
- DataTable.Cell — <td> with colspan support
- DataTable.Empty — conditional empty state row

The component shell delegates all data pipeline logic (sorting,
filtering, pagination, selection, expansion, grouping) to the
existing createDataTable composable — no behavior reimplementation.

Closes #512
Part of #507
Adds DataTable.vue fixture to the a11y browser test registry so that
the accessibility sweep includes DataTable in its audit. This matches
the pattern established by other compound components.
- Fix 'should not render when items exist' test to check for rendered
  content instead of component existence (v-if inside component doesn't
  prevent findComponent from finding the instance)
- Move aria-label from Root to Table in fixture (Root renders fragment,
  can't inherit attributes)
Replace v-once / void context.onboard() render side-effect pattern
with a proper onMounted approach using a DataTableInit child component
that calls useDataTableRoot and runs onboard once on mount.

Updated:
- packages/0/src/components/fixtures/DataTable.vue
- apps/docs/src/examples/components/data-table/basic.vue
- apps/docs/src/pages/components/data/data-table.md
Emit data-direction, keep slot props live, onboard in setup, and drop
unicode sort glyphs from the example and barrel.
Drop Head/HeaderCell and column-id/row-id so the table matches
DataGrid and the Aria collection shape.
@johnleider
johnleider force-pushed the cursor/datatable-component-shell-06e4 branch from 2247eba to 3175171 Compare August 20, 2026 13:10
Same anatomy as DataGrid: Header > Row > Column.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants