Skip to content

MasterDetailLayout

A two-panel layout where the master panel (typically a list or grid) sits alongside a detail panel. Row selection in the master panel drives what is shown in the detail panel.

new MasterDetailLayout(masterComponent, detailComponent)
PropertyTypeDefaultDescription
idStringOptional component ID
masterComponentPrimary panel — usually a Grid or Listing
detailComponentSecondary panel — shows the selected item’s detail
orientationOrientationhorizontalhorizontal (side by side) or vertical
variantSplitLayoutVariantminimalVisual style
styleStringInline CSS
cssClassesStringCSS class names
var grid = Grid.builder()
.content(List.of(
GridColumn.builder().id("name").label("Name").build(),
GridColumn.builder().id("email").label("Email").build()
))
.page(new Page<>("", 10, 1, rows.size(), rows))
.build();
var detail = FormLayout.builder()
.content(List.of(
FormField.builder().id("name").label("Name").dataType(FieldDataType.string).build(),
FormField.builder().id("email").label("Email").dataType(FieldDataType.string).build()
))
.build();
MasterDetailLayout.builder()
.master(grid)
.detail(detail)
.build()

The default constructor sets orientation = horizontal and variant = minimal, which is the most common configuration. Use the builder only when you need a different orientation or variant.