Dialog

Overview

A dialog box (Dialog) is a temporary pop-up that takes focus from the page or app and requires people to interact with it. It’s primarily used for confirming actions, such as deleting a file, or asking people to make a choice.

Usage

Dialog Example
<Checkbox Label="Is Blocking Dialog" @bind-Checked=@isBlocking />
<DefaultButton Text="Open Dialog" OnClick=@(args=> dialogOpen=true) />
<Dialog Title="This is a dialog menu."
        SubText="This is the subtext area.  Below is the ChildContent area for components."
        IsOpen=@dialogOpen
        IsBlocking=@isBlocking
        OnDismiss=@(args=> dialogOpen=false )>
    <ChildContent>
        <p>
            <TextField Label="Sample TextField" />
        </p>
        <p>
            <Dropdown ItemsSource=@items!.Select(x => new DropdownOption { Key = x.DisplayName!, Text = x.DisplayName})
      Placeholder="Select an option"
      OnChange=@UncontrolledSingleChangeHandler />
        </p>
    </ChildContent>
    <FooterTemplate>
        <PrimaryButton Text="OK" OnClick=@(args=> dialogOpen=false) />
        <DefaultButton Text="Cancel" OnClick=@(args=> dialogOpen=false) />
    </FooterTemplate>
</Dialog>

<DefaultButton Text="Open Large Dialog" OnClick=@(args=> largeDialogOpen=true) />
<Dialog Title="This is a large dialog menu."
        SubText="This is the subtext area.  Below is the ChildContent area for components."
        IsOpen=@largeDialogOpen
        IsBlocking=@isBlocking
        DialogType=@DialogType.LargeHeader
        OnDismiss=@(args=> largeDialogOpen=false )>
    <ChildContent>
        <p>
            <TextField Label="Sample TextField" />
        </p>
        <p>
            <Dropdown ItemsSource=@items!.Select(x=>new DropdownOption { Key = x.DisplayName!, Text = x.DisplayName})
      Placeholder="Select an option"
      OnChange=@UncontrolledSingleChangeHandler />
        </p>
    </ChildContent>
    <FooterTemplate>
        <PrimaryButton Text="OK" OnClick=@(args=> largeDialogOpen=false) />
        <DefaultButton Text="Cancel" OnClick=@(args=> largeDialogOpen=false) />
    </FooterTemplate>
</Dialog>