Docs

Documentation versions (currently viewingVaadin 25.4 (pre-release))

Spacing & Alignment

Turn a layout’s padding and gap on or off, and align its components, from the layout’s badge.

A layout’s badge has switches for its padding and for the gap between its components, and a button for its alignment. Copilot writes the change to your Java code.

Pad the buttons' layout and center the view
  1. Select a layout, here the one around the buttons: click Save and press ← for its parent. The layout’s badge has the Pad and Gap switches, and Alignment.

  2. Turn Pad on. The layout gets padding around its buttons, and Copilot writes it to ContactView.java.

  3. Click beside the form to select the view, which is a vertical layout too. In Alignment, choose to align its components to the center: the title, the form and the buttons move to the middle.

More Options

Alignment also has Justify, which places the components along the layout’s direction, and Wrap, which lets them continue on a new row or column.