HorizontalLayout is a convenience layout for arranging components horizontally.
It provides the same general layout and cell configuration as BasicLayout, but always uses a horizontal direction.
The following example arranges three cells horizontally, using different background colors, padding and spacing.
| Constructor | Description |
|---|---|
| HorizontalLayout() | Creates a horizontal layout. |
HorizontalLayout is useful when components should remain next to each other, such as toolbar items, navigation elements, buttons and small groups of information.
Components are added from left to right using the add() method.
The setGap() method controls the spacing between cells, while each cell can have its own padding, background color, alignment and size.
HorizontalLayout can also be nested inside other layouts to build more complex interfaces.
HorizontalLayout exposes the same general sizing, spacing, border, background, shadow, alignment, overflow and cell configuration used by BasicLayout.
See the BasicLayout documentation for the complete layout API.
The main difference is that HorizontalLayout already uses a horizontal direction, so there is no need to create it with BasicLayout.Direction.HORIZONTAL.