Responsive table
v0.72.0, changelogThe same rows as a Table where there is room and as a grouped list under 36rem of its own width, from one list of columns, rendering only one so the semantics fit.
Fleet
Install
npx shadcn add @syncrobotic/responsive-table Also installs: @syncrobotic/cn, @syncrobotic/table, @syncrobotic/list
Overview
When to use
- A robot, incident or user list a page shows on desks and phones.
- A table in a dashboard column that can be narrow.
Use something else
- Many columns to sort, filter and select: Data grid.
- Rows only ever on a phone or in a side panel: Grouped list.
- Rows that only show on wide screens: Table.
Which one: DescriptionList, Item, Table or DataGrid
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
With actions
Narrow column
Long titles
Empty
Bare
Sticky first column
Usage rules
- Rows that people open on phones as well as on desks: one list of columns renders a Table where there are 36rem (576 px) of its own width, and a grouped list (ListGroup, ListRow) under that. Its own width decides, so a narrow column on a wide screen gets the list too.
- Only one layout is in the page at a time, so a screen reader never meets the rows twice: table semantics on wide screens, a list of list items on phones. Before it is measured (the server's HTML) a container query shows the right one.
- Each column says where it goes on a phone: the first is the row's title,
trailingthe state at the row's end (InlineStatus, one column), the rest the line under the title (meta, one or two facts) orhidden.phoneCellgives a shorter form ("82 %" for a meter). - The phone row's title wraps to two lines rather than being cut, and the trailing state moves under it before squeezing the title below 160 px.
onRowClickmakes the title cell a button in the table and the whole phone row a 56 px button with a chevron.rowActionsis the ⋯ menu: TableActionsCell in the table, after the row's button on a phone.- Numbers
align:, written in full (formatCount). No rows:"end" emptywith an inline EmptyState. bareinside a surface (a card, a panel): neither the table nor the phone list draws an edge of its own, so frames never nest.stickyFirstColumnkeeps the title column in view while the table scrolls sideways.- Many columns to scan, sort and select on a desk: DataGrid. A list that is only ever on phones: ListGroup and ListRow.
Changelog
- 0.72.02026-12-04
bare(no edge of its own on the table or the phone list, inside a surface) andstickyFirstColumn(Table's, in the table layout) (#549). - 0.67.02026-12-02Its first measure keeps the rows mounted: one tree in every mode, so a press or focus made during hydration is not lost (#417).
- 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.