LyteNyte Grid logo for light mode. Links back to the documentation home page.
Rows

Row Master Detail

Create expandable detail sections beneath rows using customizable React components, expansion controls, and programmatic API methods.

Enabling Row Detail

Row detail functionality in LyteNyte Grid is always enabled. Any row can display a detail section. To create a detail section, define a rowDetailRenderer on the grid state object. LyteNyte Grid uses this renderer to render the content of each row’s detail area.

The demo shows row detail in action. The marker column renders a detail toggle that calls api.rowDetailToggle, which adds or removes the row ID from the rowDetailExpansions set to control which rows display an expanded detail area.

Row Detail

Fork code on stack blitzFork code on code sandbox

Row Detail Height

Use rowDetailHeight property on the grid to control the height of the detail section. The rowDetailHeight property accepts one of the following values:

  • Number: A fixed height in pixels.
  • Auto: The string value "auto", which sizes the detail section based on its content.

By default, the grid uses a numeric height. Use "auto" when the detail content should determine its own height.

Row Detail Height

Fork code on stack blitzFork code on code sandbox

Nested Grids

A common use case for row detail is rendering nested grids or tables. In this pattern, a master grid expands to reveal a child grid within the detail area. LyteNyte Grid supports this pattern by allowing a grid to be rendered inside a row detail section.

The demo below shows a nested grid rendered inside the detail area of a row:

Nested Grid Row Detail

Fork code on stack blitzFork code on code sandbox

A nested grid is not a special case. To create one, have the detail renderer return another grid instance. LyteNyte Grid places no restrictions on what the detail renderer can display.

Controlled Detail Expansion State

The rowDetailExpansions property on the grid determines which rows have their detail area expanded. If you do not set rowDetailExpansions on the grid, LyteNyte Grid tracks detail expansion using internal, uncontrolled state.

By providing a rowDetailExpansions value, you can control which rows have their detail area expanded to align with your application’s intended behavior. By listening to onRowDetailExpansionChange, you can update your controlled expansion state accordingly.

A typical use case is to limit the grid to display only one expanded row detail area at a time, so that expanding a different row’s detail area automatically collapses any other open detail areas. The demo below demonstrates this behavior.

Controlled Detail Expansions

Fork code on stack blitzFork code on code sandbox

Next Steps

  • Row Height: Change row height, support variable-height rows, and configure fill-height rows.
  • Row Pinning: Freeze rows at the top or bottom of the viewport.
  • Row Selection: Select single or multiple rows.
  • Row Full Width: Create rows that span the full width of the viewport.