The Dialogs interface is designed to display standard dialog windows. A dialog window is a small popup window that you can use to present information and user interface elements in an overlay.

The createMessageDialog() and createOptionDialog() methods are the entry points to the fluent interface that allows you to construct and show dialogs.

Message Dialog

The most basic use case for a message dialog is showing some message to the user.

In the following example, a message dialog is shown when the user clicks a button:

private Dialogs dialogs;

public void onHelloButtonClick(ClickEvent<Button> event) {

Option Dialog

The option dialog displays a message and a set of buttons for user reaction.

Use the withActions() method to provide actions, each of which is represented by a button in the dialog. For example:

private Dialogs dialogs;

public void onSelectOptionButtonClick(ClickEvent<Button> event) {
            .withHeader("Please confirm")
            .withText("Do you really want to add a customer?")
                    new DialogAction(DialogAction.Type.YES)
                            .withHandler(e -> addCustomer()),
                    new DialogAction(DialogAction.Type.NO)