Skip to content

Form

The standard fluent content container. Use Form to wrap the content of a page — it provides a title, subtitle, header, footer, toolbar, and button areas alongside its main content list.

@Builder
public record Form(
String id,
String title,
String subtitle,
boolean noHeader,
Component avatar,
List<Component> content,
List<Component> header,
List<Component> footer,
List<UserTrigger> toolbar,
List<UserTrigger> buttons,
String style,
String cssClasses)
implements Component, ContentSupplier, PageMainContent { }
PropertyTypeDefaultDescription
idStringOptional component ID
titleStringPage/section heading
subtitleStringSubheading shown below the title
noHeaderbooleanfalseHides the title/subtitle header area
avatarComponentAvatar component shown in the header
contentList<Component>[]Main body components
headerList<Component>[]Components placed above the content
footerList<Component>[]Components placed below the content
toolbarList<UserTrigger>[]Action buttons in the toolbar
buttonsList<UserTrigger>[]Action buttons at the bottom
styleStringInline CSS
cssClassesStringCSS class names
return Form.builder()
.title("Customer")
.subtitle("Customer detail view")
.contentItem(new Text("Name: John Doe"))
.contentItem(new Text("Email: john@example.com"))
.build();
return Form.builder()
.title("Edit Customer")
.contentItem(FormLayout.builder()
.content(List.of(
FormField.builder().id("name").label("Name").dataType(FieldDataType.string).build(),
FormField.builder().id("email").label("Email").dataType(FieldDataType.email).build()
))
.build())
.toolbarItem(Action.builder().id("save").build())
.toolbarItem(Action.builder().id("cancel").build())
.build();
return Form.builder()
.title("Report")
.headerItem(new Text("Generated: " + LocalDate.now()))
.contentItem(reportContent)
.footerItem(new Text("Confidential — do not distribute"))
.build();
return Form.builder()
.noHeader(true)
.contentItem(content)
.build();
  • Form is the most common return type of ComponentTreeSupplier.component().
  • The builder uses @Singular for list properties, so methods like contentItem(...), headerItem(...), footerItem(...), toolbarItem(...), and buttons(...) add a single item at a time.