Documentation
Asgard
Getting started
Theming
Guides
Inputs & forms
Pickers
Data display
Layout & docking
Feedback & overlays
Navigation & chrome
Feedback & overlays
Promise-based confirm / prompt / custom dialogs.
A promise-based popup system for modal confirmations, prompts, and custom dialogs via a hook API.
Key features:
usePopupshook withconfirm,prompt, andcustommethods- All methods return promises for clean async/await patterns
confirmwith customizable labels and danger variantpromptwith input validation and default values
Loading preview…
When to use it
- Destructive-action confirmations
- Quick single-field prompts
- Custom modal content with actions
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
confirm(config) | Promise<boolean> | — | Shows a confirmation dialog and resolves to true if confirmed, false if cancelled. |
config.message | string | — | The confirmation message displayed in the dialog body. |
config.title | string | — | Optional title for the confirmation dialog header. |
config.confirmLabel | string | — | Custom label text for the confirm button. |
config.cancelLabel | string | — | Custom label text for the cancel button. |
prompt(config) | Promise<string | null> | — | Shows a text input prompt and resolves to the entered string, or null if cancelled. |
config.defaultValue | string | — | Pre-filled value for the prompt input field. |
config.validation | (value: string) => string | null | — | Validation function returning an error message string or null if valid. |
Notes
- Wrap your application in PopupsProvider to enable the popup system throughout the component tree.
- All popup methods return promises that resolve when the user responds, making them ideal for use with async/await in event handlers.
- The usePopups hook provides confirm, prompt, and custom methods for different dialog types.
Presets