Skip to content

DataTable: opt-in mobile card layout #556

Closed

Description

@woksin

What happens

DataTable renders only a table layout. On narrow screens wide tables need horizontal scrolling or are unusable, and there is no built-in compact alternative.

Evidence

  • @cratis/components 4.47.0: dist/esm/styles.DataTables.css contains no responsive rule for the table; the only max-width media query (line 865) belongs to the number input, the others are prefers-reduced-motion and forced-colors.
  • dist/esm/DataTables/DataTableCore.d.ts and DataTableStateProps.d.ts expose no layout or breakpoint option.
  • dist/esm/DataTables/ contains table, head, body, row and paginator parts only; there is no card/list rendering.

What it costs a consumer

Apps with mobile users build and maintain a second list component next to every table, and re-implement selection, sorting and paging for it.

Suggested fix — the seam

An opt-in layout mode that renders each row as a card, using column headers as labels, below a configurable breakpoint, reusing the existing selection, sorting and paging state.

<DataTable value={rows} mobileLayout="cards" mobileBreakpoint={640}>...</DataTable>

What is explicitly not being asked for

  • No default change; the table remains the only layout unless the prop is set.
  • No prescription of card styling beyond what slots/tokens already allow.

Upgrade impact

None. The option is opt-in.

Activity

  1. self-assigned this
    on Nov 21, 2026
  2. woksin commented on Nov 21, 2026

    @woksin
    ContributorAuthor

    Delivered in #563 (merged). DataTableCore, DataTableForQuery and DataTableForObservableQuery now take an opt-in mobileLayout='cards' prop, with mobileBreakpoint to change the viewport threshold (640 CSS pixels by default). Card mode has its own sort and selection controls. Focus and selection carry over when the layout switches. Without the prop, the table renders as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions