# Alert Dialog Source: https://native.shellui.dev/docs/components/overlay/alert-dialog ## 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. **MAUI** ```xml ``` **Avalonia** ```xml ``` [Live preview](https://native.shellui.dev/preview/index.html?c=alert-dialog-basic) ```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. |