A vertical layout layouts children vertically.

  • Fluent
  • Declarative

    VerticalLayout.builder()
        .content(List.of(
            buildPanel(),
            buildPanel()
        ))
        .build()

    // ...

    private Object buildPanel() {
      // returns any component or object;
    }

    @VerticalLayout
    List panels = List.of(
        buildPanel(),
        buildPanel()
      );

    // ...

    private Object buildPanel() {
      // returns any component or object;
    }
    

or


    @VerticalLayout
    class Container {
      Object left = buildPanel();
      Object right = buildPanel();
    }

Available properties

This is the list of available properties for a vertical layout:

PropertyDescriptionNotes
idid for this component
cssClasseslist of css classescontent of the css attribute
styleinline style attributescontent of the style attribute
paddingto add some padding to the elementstrue/false
spacingto add some spacing between elementstrue/false
fullWidthshortcut to set width:100%true/false
justificationjustification of elementsone of START, CENTER, END, BETWEEN, AROUND, EVENLY
flexGrowslist of flex grows values for elementse.g. List.of(0,0,1,0)
spacingVariantamount of space between elementsone of xs, x, m, l, xl
wrapwrap if content does not fittrue/false
horizontalAlignmenthorizontal alignment for elementsone of STRETCH, START, CENTER, END

You can see a full explanation of those properties at https://vaadin.com/docs/latest/components/vertical-layout