Documentation

Data Table

Expandable Rows

Rows that slide open a detail panel right underneath them.

Preview

Szczegóły wierszaOrderCustomerStatusTotal
#1042John DoeDelivered$142.99
  • Mechanical keyboard × 1$89.00
  • Keycap set (Ocean) × 2$49.00
Subtotal
$138.00
Shipping
$4.99
Total
$142.99
#1043Jane SmithProcessing$134.00
#1044Alice JohnsonDraft$0.00
#1045Bob BrownRefunded$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-expanded and aria-controls. Enter and Space work, and rowOpens clicks 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

On this page