Skip to content

FormLayout

A responsive multi-column grid designed to host form fields. Mateu uses it as the standard container for FormField components.

FormLayout.builder()
.content(List.of(
FormField.builder().id("name").label("Name").dataType(FieldDataType.string).build(),
FormField.builder().id("age").label("Age").dataType(FieldDataType.integer).build()
))
.build()
PropertyTypeDefaultDescription
idString—Optional component ID
contentList<Component>—Fields and other components placed in the grid
autoResponsivebooleanfalseAutomatically adjusts columns to available width
labelsAsidebooleanfalsePlaces field labels beside the input instead of above
maxColumnsint0Maximum number of columns (0 = unlimited)
columnWidthString—CSS width for each column (e.g. "200px")
expandColumnsbooleanfalseColumns stretch to fill available space
expandFieldsbooleanfalseFields stretch to fill their column
itemLabelWidthString—CSS width for all labels when labelsAside = true
columnSpacingString—Gap between columns
itemRowSpacingString—Gap between rows
itemLabelSpacingString—Gap between label and field
styleString—Inline CSS
cssClassesString—CSS class names

Let Mateu choose the number of columns based on viewport width:

FormLayout.builder()
.autoResponsive(true)
.content(List.of(field1, field2, field3, field4))
.build()
FormLayout.builder()
.maxColumns(2)
.content(List.of(field1, field2, field3, field4))
.build()
FormLayout.builder()
.labelsAside(true)
.itemLabelWidth("120px")
.content(List.of(field1, field2))
.build()

Use FormRow inside FormLayout to explicitly control which fields share a row:

FormLayout.builder()
.autoResponsive(true)
.content(List.of(
FormRow.builder()
.content(List.of(firstNameField, lastNameField))
.build(),
FormRow.builder()
.content(List.of(emailField, phoneField))
.build()
))
.build()