Data Table
Expandable Rows
Rows that slide open a detail panel right underneath them.
Preview
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