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
headerTitleString—Text shown in the dialog header bar
headerComponent—Custom header component (replaces headerTitle)
contentComponent—Main body content
footerComponent—Footer content (typically buttons)
noPaddingbooleanfalseRemoves the default content padding
modelessbooleanfalseAllows interaction with the page behind the dialog
topString—CSS top position (for positioned dialogs)
leftString—CSS left position
draggablebooleanfalseLets users drag the dialog
widthString—CSS width
heightString—CSS height
resizablebooleanfalseLets users resize the dialog
closeButtonOnHeaderbooleanfalseAdds an × close button to the header
styleString—Inline CSS
cssClassesString—CSS 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.