Skip to content

VerticalLayout

Stacks its children vertically, one below the other.

VerticalLayout.builder()
.content(List.of(
new Text("First"),
new Text("Second")
))
.build()
PropertyTypeDefaultDescription
idString—Optional component ID
contentList<Component>—Child components stacked top to bottom
spacingbooleanfalseAdds gap between children
paddingbooleanfalseAdds inner padding
marginbooleanfalseAdds outer margin
spacingVariantSpacingVariant—Controls spacing size
horizontalAlignmentHorizontalAlignment—Aligns children horizontally (start, center, end, stretch)
justificationHorizontalLayoutJustification—Justification mode
wrapbooleanfalseAllows wrapping
flexGrowsList<Integer>[]Flex-grow values per child
fullWidthbooleanfalseStretches to full width
hiddenOverflowbooleanfalseHides overflow content
styleString—Inline CSS
cssClassesString—CSS class names
// from a list
new VerticalLayout(List.of(comp1, comp2))
// varargs
new VerticalLayout(comp1, comp2, comp3)
VerticalLayout.builder()
.content(List.of(new Text("A"), new Text("B")))
.spacing(true)
.padding(true)
.build()
VerticalLayout.builder()
.content(List.of(new Text("Centered")))
.horizontalAlignment(HorizontalAlignment.center)
.build()
VerticalLayout.builder()
.content(List.of(new Text("Fills row")))
.fullWidth(true)
.build()