Data Table
Expandable Rows
Rows that slide open a detail panel right underneath them.
Preview
| Szczegóły wiersza | Order | Customer | Status | Total |
|---|---|---|---|---|
| #1042 | John Doe | Delivered | $142.99 | |
| ||||
| #1043 | Jane Smith | Processing | $134.00 | |
| #1044 | Alice Johnson | Draft | $0.00 | |
| #1045 | Bob Brown | Refunded | $47.46 | |
Showing 1–4 of 4
Usage
For rows with more to say than a cell holds, like an order's line items or a job's error log. Each row gets a chevron that opens a panel in place.
<ContentDataTable
id="orders-table"
expandable={{
render: (order) => <OrderDetail order={order} />,
canExpand: (order) => order.items.length > 0,
}}
columns={columns}
edges={data.edges}
pageInfo={data.pageInfo}
order={{ defaultOrder: { column: 'number', order: 'asc' } }}
/>- Several rows can be open. Open state lives in the component, not the URL, and rows that leave the page are forgotten.
- The chevron is a real button with
aria-expandedandaria-controls. Enter and Space work, androwOpensclicks still work on the rest of the row. - Works with
bulkActions. The chevron sits right after the checkbox. - Polite motion. The panel springs open in about 300ms. With reduced motion it only fades.
Fetch heavy details in the panel
render runs only while a row is open. If the panel needs data the list
didn't load, fetch it inside the panel with TanStack Query, so re-opening is
instant.
API
Prop
Type