Library Blazor Components Dialog Reference Classes Dialog Buttons

Buttons

Specifies a combination of buttons to be shown inside a dialog.

razor
[Parameter]
public DialogButton Buttons { get; set; } = DialogButton.Ok | DialogButton.Cancel;

DialogButton enumeration support combining enum items and therefore any combination of buttons can be used.

Examples

In this example only one button (Close) is being shown.

razor
<Dialog Title="Alert" Buttons="DialogButtons.Close">
  This is an alert    
</Dialog>

In this example 2 buttons are shown and pressed button can be handled.

razor
<Dialog @bind-IsOpen="_dialogOpen" Title="Confirmation" Buttons="DialogButton.Yes | DialogButton.No" OnButtonClick="HandleButtonClick">
    Are you sure at you want to delete item?
</Dialog>

@code {
    private void HandleButtonClick(DialogButton dialogButton)
    {
        if (dialogButton == DialogButton.Yes)
        {
            
        }
    }
}

Sign in