Dialog

A modal window over the page, with a backdrop.

Declare it anywhere, next to the button that opens it: the content covers the window while it's open. Escape, the backdrop, the close button or any DialogClose closes it. While it's open, keyboard focus stays inside.

Installation

bash
shellui-native add dialog

Platforms: MAUI · Avalonia. Also installs dialog-trigger, dialog-content, dialog-header, dialog-footer, dialog-title, dialog-description, dialog-close, element-extensions, icon.

Usage

Basic

Rendered with ShellUI for Blazor
<ui:Dialog x:Name="ProfileDialog">
    <ui:DialogTrigger>
        <ui:Button Text="Edit profile" Variant="Outline" />
    </ui:DialogTrigger>
    <ui:DialogContent>
        <ui:DialogHeader>
            <ui:DialogTitle Text="Edit profile" />
            <ui:DialogDescription Text="Make changes to your profile here. Click save when you're done." />
        </ui:DialogHeader>
        <VerticalStackLayout Spacing="8">
            <ui:ShellLabel Text="Name" Size="Sm" Weight="Medium" />
            <ui:Input Text="Shewart Shepherd" />
        </VerticalStackLayout>
        <ui:DialogFooter>
            <ui:DialogClose><ui:Button Text="Cancel" Variant="Outline" /></ui:DialogClose>
            <ui:DialogClose><ui:Button Text="Save changes" /></ui:DialogClose>
        </ui:DialogFooter>
    </ui:DialogContent>
</ui:Dialog>
Avalonia, running in your browser

From code

csharp
ProfileDialog.SetOpen(true);
ProfileDialog.OpenChanged += (_, open) => Status.Text = open ? "Editing" : "Closed";

MAUI and Avalonia

On Avalonia the XAML children of Dialog and DialogContent are collected in Items. Otherwise the same.

API

Dialog

XAML children go to Items on Avalonia.

Property Type Default Description
Open bool false Whether it's open. Two-way bindable.
Event Arguments Description
OpenChanged bool Opened or closed.
Method Description
SetOpen(bool value) Opens or closes it.

DialogTrigger

Method Description
Activate() Does what pressing it does.
ShellTriggerView.ActivateAncestor(Element from) Called by interactive children (Button) after they handle a click.

DialogContent

XAML children go to Items on Avalonia and Children on MAUI.

Property Type Default Description
ShowCloseButton bool true Shows the close button in the corner.

DialogHeader

XAML children go to Children.

No properties of its own.

DialogTitle

Property Type Default Description
Text string — Text shown by the component.

DialogDescription

Property Type Default Description
Text string — Text shown by the component.

DialogFooter

XAML children go to Children.

No properties of its own.

DialogClose

Method Description
Activate() Does what pressing it does.
ShellTriggerView.ActivateAncestor(Element from) Called by interactive children (Button) after they handle a click.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.