Dialog Service
Dialog Service
Programmatic dialogs, alerts, and confirmations with async/await API.
Quick Actions
Common dialog patterns with one-liner API.
Click any button above to trigger a dialog. The result will appear below the buttons.
Custom Dialogs
Advanced configurations with DialogOptions.
Architecture
DialogService uses the AlertDialog component wrapped in DialogHost. Add DialogHost once in your root layout to enable dialogs throughout your app.
Add DialogHost to your MainLayout.razor or App.razor:
Register DialogService in Program.cs:
builder.Services.AddScoped<DialogService>();- Consistent dialog interface across all pages and components
- No need to manage dialog state in each component
- Single DialogHost handles all dialogs — no duplicate overlays
- Built on top of accessible AlertDialog primitive
- Async/await API makes dialog flows easy to read
API Reference
Component parameters and their types.
| Prop | Type | Default | Description |
|---|---|---|---|
| ConfirmDeleteAsync | Task<bool> | — | Shows a destructive delete confirmation with item name and optional message. |
| ConfirmRemoveAsync | Task<bool> | — | Shows a remove confirmation dialog. |
| WarnAsync | Task<bool> | — | Shows a warning confirmation dialog. |
| AlertAsync | Task | — | Shows an informational alert with an OK button. |
| SuccessAsync | Task | — | Shows a success notification dialog. |
| ErrorAsync | Task | — | Shows an error dialog. |
| ShowAsync | Task<DialogResult> | — | Shows a fully customizable dialog using DialogOptions. |