Skip to content

Dialog

A modal overlay panel. Can contain any component as its header, body, and footer.

Dialog.builder()
.headerTitle("Information")
.content(new Text("This action cannot be undone."))
.closeButtonOnHeader(true)
.build()
PropertyTypeDefaultDescription
headerTitleStringText shown in the dialog header bar
headerComponentCustom header component (replaces headerTitle)
contentComponentMain body content
footerComponentFooter content (typically buttons)
noPaddingbooleanfalseRemoves the default content padding
modelessbooleanfalseAllows interaction with the page behind the dialog
topStringCSS top position (for positioned dialogs)
leftStringCSS left position
draggablebooleanfalseLets users drag the dialog
widthStringCSS width
heightStringCSS height
resizablebooleanfalseLets users resize the dialog
closeButtonOnHeaderbooleanfalseAdds an × close button to the header
styleStringInline CSS
cssClassesStringCSS class names
Dialog.builder()
.headerTitle("Edit user")
.content(FormLayout.builder()
.content(List.of(
FormField.builder().id("name").label("Name").dataType(FieldDataType.string).build(),
FormField.builder().id("email").label("Email").dataType(FieldDataType.string).build()
))
.build())
.footer(new HorizontalLayout(
Button.builder().label("Save").actionId("save_user").build(),
Button.builder().label("Cancel").actionId("cancel").build()
))
.closeButtonOnHeader(true)
.width("500px")
.build()
Dialog.builder()
.headerTitle("Floating panel")
.content(new Text("Drag me around"))
.draggable(true)
.top("100px")
.left("200px")
.build()
Dialog.builder()
.headerTitle("Resizable")
.content(detailContent)
.resizable(true)
.width("600px")
.height("400px")
.build()

For simple yes/no confirmations use ConfirmDialog instead, which wires the confirm/cancel buttons automatically.