VerticalLayout is a convenience layout for arranging components vertically.
It provides the same general layout and cell configuration as BasicLayout, but always uses a vertical direction.
The following example arranges three cells vertically, using different background colors, padding and spacing.
| Constructor | Description |
|---|---|
| VerticalLayout() | Creates a vertical layout. |
VerticalLayout is useful when components should be stacked from top to bottom, such as page sections, forms, menus and groups of information.
Components are added vertically 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.
VerticalLayout can also contain HorizontalLayout components, making it easy to combine horizontal and vertical arrangements.
VerticalLayout 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 VerticalLayout already uses a vertical direction, so there is no need to create it with BasicLayout.Direction.VERTICAL.