View as Markdown

Detail Template

Detail rows

Expandable detail rows with a render prop, async loading, per-row and expand-all control, keyboard support and virtualization.

renderDetail renders a detail row below every expanded row. The grid adds a toggle column in front of the columns; the detail row is one role="row" with a single cell spanning every column, so it spans the full width even with pinned columns. With pinned rows (row pinning), detail rows belong to the scrolling rows only: a pinned row shows no toggle and no detail row, and Enter on its toggle cell does nothing. api.expandDetail() still records the expansion of a pinned row, and its detail row appears once the row is unpinned. Detail rows of scrolling rows render directly below their row, under the pinned zone, and scroll with it. The toggle button carries aria-expanded (a row of a grid may not), and the parent row data-expanded for styles and row templates. detailHeight is the estimated height before the row is measured (default 150 px).

<DataGrid
  aria-label="Orders"
  data={orders}
  columns={columns}
  renderDetail={({ row, collapse }) => <OrderSummary order={row} onClose={collapse} />}
/>

Loading and rows without a detail

loadDetail({ rowId, row, signal }) loads the content of a row when it is expanded. renderDetail receives status (loading, ready, error), data, error and retry; the load runs once per row object and is aborted when the row is replaced. hasDetail(row) hides the toggle for rows without a detail.

Expanding

Methods expand or collapse one detail row or all of them: expandDetail(rowId), collapseDetail(rowId), toggleDetail(rowId), expandAllDetails(), collapseAllDetails(), isDetailExpanded(rowId). defaultExpandedDetails starts with every row (true) or a list of row ids expanded. onBeforeDetailToggle (cancel with preventDefault()) and onDetailToggle fire for each row. Expansion is kept by row id across sorting, filtering, paging and data updates.

Keyboard

Enter or Space on the toggle cell toggles the detail. Arrow keys move onto the detail row; Enter moves focus into its content and Escape returns. Mod+ArrowDown and Mod+ArrowUp (Mod is Ctrl, or ⌘ on macOS) expand and collapse every detail row when the grid is not grouped.

Virtualization and export

Detail rows are rows of the virtualized row model: only rendered detail rows mount, and their measured heights feed sparse row metrics, so a grid of 10,000 expanded rows scrolls like a plain one. Excel and PDF exports follow the expansion (hierarchy: 'expanded' | 'all' | 'none'): the detail export hook returns { text } lines for a detail template, and child grids are written automatically (see Child grids). print() and printing take the same detail hook, so a detail template prints as its { text } lines. In 'expanded' mode (the default) only rows whose detail is expanded get a block, whatever the hook returns for the others; 'all' calls the hook for every row and 'none' writes no detail rows. CSV has no detail rows.

Detail rows

Open demo

A detail row under each expanded order of 10,000 virtualized rows, with an async loader, rows without a detail, expand-all and toggle events.

Details
Order
Customer
Country
Product
Amount
Placed
ORD-10000
Dewi Lestari
France
Green tea
$7.86
Jan 8, 2026
ORD-10001
Aiko Tan
Germany
Espresso beans
$94.35
Mar 22, 2026
ORD-10002
Goran Petrov
Japan
Oolong tea
$137.70
May 20, 2026
ORD-10003
Goran Petrov
Malaysia
Espresso beans
$210.90
Jan 8, 2026
ORD-10004
Hana Sato
Malaysia
Filter beans
$35.70
Oct 23, 2026
ORD-10005
Hana Sato
France
Kettle
$649.00
Jan 9, 2026
ORD-10006
Ines Duarte
France
Kettle
$61.66
Sep 6, 2026
ORD-10007
Goran Petrov
Japan
Kettle
$64.90
Sep 21, 2026
ORD-10008
Goran Petrov
Portugal
Filter beans
$28.00
Jun 17, 2026
ORD-10009
Farah Aziz
Malaysia
Oolong tea
$60.56
Dec 7, 2026
ORD-10010
Aiko Tan
Portugal
Espresso beans
$141.53
May 23, 2026
ORD-10011
Dewi Lestari
Japan
Green tea
$23.59
Nov 21, 2026
ORD-10012
Hana Sato
Malaysia
Grinder
$767.55
Sep 26, 2026
ORD-10013
Jun Park
Malaysia
Kettle
$330.99
Apr 18, 2026
ORD-10014
Dewi Lestari
Malaysia
Filter beans
$106.40
Aug 28, 2026
ORD-10015
Elif Kaya
Japan
Green tea
$74.00
Sep 14, 2026
ORD-10016
Dewi Lestari
Germany
Grinder
$464.40
Dec 24, 2026
ORD-10017
Aiko Tan
Japan
Filter beans
$71.40
Sep 4, 2026
ORD-10018
Chen Wei
Portugal
Grinder
$1,102.95
Dec 11, 2026
ORD-10019
Farah Aziz
Japan
Green tea
$83.25
Apr 11, 2026

Low-priority orders have no detail. Keyboard: Enter or Space on the toggle cell, Enter on a detail row moves into it, Escape returns, Ctrl+Down / Ctrl+Up expand or collapse all.

No events yet.

API reference

DataGridDetailContext, DataGridDetailLoadContext and DataGridDetailToggleEvent describe the render, load and toggle payloads; DataGridProps lists the detail props and DataGridApi the expand methods.