Library Blazor Components Dialog Reference Classes Dialog IsOpen

IsOpen

Specifies whether a dialog is open (visible). The property supports two-way binding.

razor
[Parameter]
public bool IsOpen { get; set; }

If user close the dialog (e.g. clicking on one of the buttons or on the close button), the property will be automatically set to false.

Examples

This example shows how a dialog’s visibility can be controlled by a local field.

razor
@using BergSoft.UI
@using BergSoft.UI.Blazor

<Button OnClick=“OpenDialog”>Add</Button>

<Dialog @bind-IsOpen="_addDialogOpen" Title="Add product">
  dialog content
</Dialog>

@code {
    private bool _addDialogOpen;

    private void OpenDialog()
    {
        _addDialogOpen = true;
    }
}

Sign in