Installation

bash
shellui-native add alert-dialog

Platforms: MAUI · Avalonia. Also installs element-extensions, button, icon, button-variants.

Usage

Basic

Open it from code with ShowAsync(), which completes with the choice. Escape counts as Cancel.

Rendered with ShellUI for Blazor
<ui:Button Text="Delete account" Variant="Destructive" Clicked="OnDeleteClicked" />
<ui:AlertDialog x:Name="DeleteDialog"
                Title="Are you absolutely sure?"
                Description="This action cannot be undone. This will permanently delete Shewart's account and remove the data from our servers."
                ConfirmText="Delete account" ConfirmVariant="Destructive" />
Avalonia, running in your browser
csharp
private async void OnDeleteClicked(object? sender, EventArgs e)
{
    if (await DeleteDialog.ShowAsync())
        Toast.Success("Account deleted");
}

MAUI and Avalonia

Extra content between the description and the buttons: one Body view on MAUI, any XAML children on Avalonia.

API

AlertDialog

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

Property Type Default Description
Title string — Heading text.
Description string — Supporting text under the title.
ConfirmText string "Continue" Text of the confirm button.
CancelText string "Cancel" Empty hides the cancel button.
ConfirmVariant ButtonVariant Default Button variant of the confirm button (Destructive for deletions). One of Default, Destructive, Outline, Secondary, Ghost, Link.
Body View null Extra content between the description and the buttons. MAUI only.
Open bool false Whether it's open. Two-way bindable.
Event Arguments Description
Confirmed — The confirm button was pressed.
Cancelled — Cancel, Escape or the back button.
OpenChanged bool Opened or closed.
Method Description
ShowAsync() Opens the dialog and completes with true (confirm) or false (cancel).
SetOpen(bool value) Opens or closes it.

AlertDialogTrigger

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.