An horizontal layout layouts children horizontally.

  • Fluent
  • Declarative

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

    // ...

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

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

    // ...

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

or


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

Available properties

This is the list of available properties for an horizontal 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
verticalAlignmentvertical alignment for elementsone of STRETCH, START, CENTER, END, BASELINE

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