Confirm Dialog
Promise-based confirmation dialogs surfaced from anywhere via IConfirmService. Awaits a bool — true = confirmed, false = cancelled or backdrop-dismissed.
Tones
Three confirmation tones
Neutral for harmless prompts, Warning for reversible-but-meaningful actions, Danger for destructive ones (red Confirm button, no backdrop dismiss).
razor
@inject IConfirmService Confirm
@* Neutral *@
if (await Confirm.AskAsync("Discard changes?", "Your edits will be lost."))
{
DiscardEdits();
}
@* Warning *@
if (await Confirm.AskWarningAsync("Sign out everywhere?", "All sessions will end."))
{
await SignOutEverywhere();
}
@* Danger - red button, backdrop dismiss disabled *@
if (await Confirm.AskDangerAsync(
title: "Delete patient?",
message: "Patient #4521 will be moved to trash.",
confirmText: "Delete patient"))
{
await DeletePatient(id);
}Compose with Toast
Ask → act → notify
The canonical destructive flow: confirm intent, perform the action, then surface a toast (with optional Undo).
razor
@inject IConfirmService Confirm
@inject IToastService Toasts
if (await Confirm.AskDangerAsync("Delete this record?", "Moved to trash. Undo for 5 seconds."))
{
Toasts.Show(new ToastOptions
{
Title = "Record deleted",
Severity = ToastSeverity.Info,
ActionText = "Undo",
DurationMs = 5000,
OnAction = async () => await RestoreRecord(id)
});
}