# dp-dialog A promise-based modal for confirmations, prompts, and alerts, replacing the browser's blocking `confirm`/`prompt`/`alert`. `Application.js` creates a single instance reachable as `app.dialog`. Source: `static/js/components/AppDialog.js`. ## Methods Each returns a Promise resolving when the user responds. | Method | Resolves with | |---|---| | `confirm(options)` | `true` if confirmed, `false` if cancelled or dismissed. | | `prompt(options)` | the entered string, or `null` if cancelled. | | `alert(options)` | `undefined` once acknowledged. | `options`: `title`, `message`, `confirmLabel`, `cancelLabel`, `danger` (red confirm button), and for `prompt`: `label`, `value`, `placeholder`. ## Usage ```html <dp-dialog></dp-dialog> ``` ```javascript const ok = await app.dialog.confirm({ title: "Delete post", message: "This cannot be undone.", danger: true, }); if (ok) { const name = await app.dialog.prompt({ label: "New name", value: "untitled" }); } ```
Live example