Founding price: $35, then $79.99 after 23:59 UTC on 4 November, then $79.99
Get ProPromise-based confirm, alert and prompt dialogs: await dialog.confirm() anywhere, with a queue so requests never overlap.
This item has no props to tune. Use the lens above to change theme, density, direction and more.
Use it when the code reads best as a sequence: if (!(await dialog.confirm({ title: 'Discard changes?' }))) return. One provider at the app root replaces a dialog component per action.
Do not use it for forms with several fields (use a dialog) or for anything that must stay on screen while the person works. Do not call it during render.
It builds on alert-dialog, input and label, which the CLI installs for you.
| Prop | Type | Default | Description |
|---|---|---|---|
confirm(options) | Promise<boolean> | - | True on confirm, false on cancel, Escape or outside press. |
alert(options) | Promise<void> | - | Resolves when the person presses OK. |
prompt(options) | Promise<string | null> | - | The typed text, or null when cancelled. |
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | - | Required dialog title. |
description | ReactNode | Please confirm to continue. | Supporting text. |
confirmLabel | string | Confirm / OK | Label of the main button. |
cancelLabel | string | Cancel | Label of the cancel button (confirm and prompt). |
destructive | boolean | false | Style the main button as destructive. |
label, defaultValue, placeholder, validate | prompt only | - | The field label (required), start value, placeholder, and a function that returns an error message. |
alert-dialog, so it has role="alertdialog", a trapped focus and a required title.role="alert" paragraph linked with aria-describedby and aria-invalid.confirm() waits until the first is answered.| Key | Action |
|---|---|
| Enter | submits the focused form control or the main button |
| Escape | cancels (confirm resolves false, prompt resolves null) |
| Tab | stays inside the dialog |
The component ships a Testing Library test (dialog-provider.test.tsx) that covers confirm true and false, Escape, prompt validation with Enter, cancel, alert and the missing provider error.