Outcome Recipes
Outcome-based recipes for @aurelia/dialog to help you build confirmations, wizards, and guarded modals quickly.
1. Simple confirmation dialog that resolves a boolean
Steps
import { IDialogController } from '@aurelia/dialog'; export class ConfirmDialog { constructor(private readonly controller: IDialogController) {} activate(model: { message: string }) { this.message = model.message; } approve() { this.controller.ok(true); } cancel() { this.controller.cancel(false); } }import { IDialogService } from '@aurelia/dialog'; import { resolve } from '@aurelia/kernel'; export class TodoList { private readonly dialogs = resolve(IDialogService); async deleteItem(item: Todo) { const { wasCancelled } = await this.dialogs.open({ component: () => import('./confirm-dialog'), model: { message: `Delete ${item.title}?` }, }); if (!wasCancelled) { await api.delete(item.id); } } }
Checklist
2. Multi-step wizard inside a dialog
Steps
Checklist
3. Guard dialog close until async work finishes
Steps
Checklist
4. Slide-in drawer using the Standard renderer
Steps
Checklist
5. Locked modal with Classic renderer options
Steps
Checklist
6. Mix renderers per dialog
Steps
Checklist
7. Global defaults versus per-open overrides
Steps
Checklist
Reference material
Last updated
Was this helpful?