1. Domino UI
  2. Layouts
  3. Grid layout

Grid Layout

A flexible grid layout container that allows arranging content in a grid-like fashion.
You can define sections within the grid and set spans for headers, footers, left panels, and right panels.

Example Usage:

 
 GridLayout gridLayout = GridLayout.create()
     .setGap("10px")
     .setHeaderSpan(SectionSpan.of(1, 3))
     .setLeftSpan(SectionSpan.of(2, 1, 1), true, true)
     .withContent(contentElement -> {
         // Add content to the main content area
     });
 RootPanel.get().appendChild(gridLayout);
 

See also :

Anatomy

grid-layout-anatomy
  1. Header section, Optional, can span down up to 6 rows.
  2. Footer section, Optional, can span up to 6 rows.
  3. Left section, Optional, can span right up to 6 columns and can span up or down to take over the space from the header and footer.
  4. Right section, Optional, can span left up to 6 column and can span up or down to take over the space from the header and footer.
  5. Content panel, Mandatory, this is the main layout content panel.

Examples

Constructors

public void GridLayout()
Creates a new instance of the GridLayout with default settings.
The grid layout is initialized with an empty content area and no sections. You can further configure the layout by adding sections and setting spans.

Static methods

public static GridLayout create()
Creates a new instance of the GridLayout with default settings.
The grid layout is initialized with an empty content area and no sections. You can further configure the layout by adding sections and setting spans.

Returns:

A new instance of the GridLayout.

Public methods

public GridLayout setGap(String gap)
Sets the gap between grid items.

gap

The gap between grid items, e.g., "10px".



Returns:

This GridLayout instance for method chaining.

public GridLayout setHeaderSpan(SectionSpan sectionSpan)
Sets the span for the header section within the grid layout. Use SectionSpan to specify the span.

sectionSpan

The span for the header section.



Returns:

This GridLayout instance for method chaining.

public GridLayout hideHeader()
Hides the header section within the grid layout.

Returns:

This GridLayout instance for method chaining.

public GridLayout setRightSpan(SectionSpan sectionSpan, boolean spanUp, boolean spanDown)
Sets the span for the right section within the grid layout. Use SectionSpan to specify the span.

sectionSpan

The span for the right section.

spanUp

Whether to span up.

spanDown

Whether to span down.



Returns:

This GridLayout instance for method chaining.

public GridLayout hideRight()
Hides the right section within the grid layout.

Returns:

This GridLayout instance for method chaining.

public GridLayout setLeftSpan(SectionSpan sectionSpan, boolean spanUp, boolean spanDown)
Sets the span for the left section within the grid layout. Use SectionSpan to specify the span.

sectionSpan

The span for the left section.

spanUp

Whether to span up.

spanDown

Whether to span down.



Returns:

This GridLayout instance for method chaining.

public GridLayout hideLeft()
Hides the left section within the grid layout.

Returns:

This GridLayout instance for method chaining.

public GridLayout setFooterSpan(SectionSpan sectionSpan)
Sets the span for the footer section within the grid layout. Use SectionSpan to specify the span.

sectionSpan

The span for the footer section.



Returns:

This GridLayout instance for method chaining.

public GridLayout hideFooter()
Hides the footer section within the grid layout.

Returns:

This GridLayout instance for method chaining.

public DivElement getContentElement()
Gets the content element within the grid layout.

Returns:

The content element.

public GridLayout withContent(ChildHandler<GridLayout, DivElement> handler)
Allows customization of the content element within the grid layout.

handler

The child handler for the content element.



Returns:

This GridLayout instance for method chaining.

public DivElement getHeaderElement()
Gets the header element within the grid layout.

Returns:

The header element.

public GridLayout withHeader(ChildHandler<GridLayout, DivElement> handler)
Allows customization of the header element within the grid layout.

handler

The child handler for the header element.



Returns:

This GridLayout instance for method chaining.

public DivElement getFooterElement()
Gets the footer element within the grid layout.

Returns:

The footer element.

public GridLayout withFooter(ChildHandler<GridLayout, DivElement> handler)
Allows customization of the footer element within the grid layout.

handler

The child handler for the footer element.



Returns:

This GridLayout instance for method chaining.

public DivElement getLeftElement()
Gets the left panel element within the grid layout.

Returns:

The left panel element.

public GridLayout withLeftPanel(ChildHandler<GridLayout, DivElement> handler)
Allows customization of the left panel element within the grid layout.

handler

The child handler for the left panel element.



Returns:

This GridLayout instance for method chaining.

public DivElement getRightElement()
Gets the right panel element within the grid layout.

Returns:

The right panel element.

public GridLayout withRightPanel(ChildHandler<GridLayout, DivElement> handler)
Allows customization of the right panel element within the grid layout.

handler

The child handler for the right panel element.



Returns:

This GridLayout instance for method chaining.

We are a group of passionate people who love what we do

Donate & Support Us