ConfirmDialog
Accessible confirmation dialog with async pending state, destructive variant and cancellable actions, built on Dialog.
Design intent
Confirmations are copy-pasted per project (79 hand-rolled modals in the audited apps), usually without focus trapping or Escape. ConfirmDialog provides the accessible default plus a pending state for async actions.
npx @slipstream-ui/cli@latest add confirm-dialogProps
| Prop | Type | Default | Description |
|---|---|---|---|
| open / onOpenChange | boolean, (open) => void | required | Controlled visibility. |
| title | string | required | Dialog title (accessible name). |
| description | string | — | Supporting line under the title. |
| onConfirm | () => void | Promise<void> | required | Confirm handler; a promise shows a pending state. |
| confirmLabel / cancelLabel | string | 'Confirm' / 'Cancel' | Button labels. |
| destructive | boolean | false | Red confirm button for destructive actions. |
Anti-patterns
validate_usage is the MCP tool that rejects these mistakes: the same list agents see over MCP and in the canonical markdown.
Don't use it for multi-field forms
ConfirmDialog is a yes/no gate; richer flows belong in Dialog.
tsx// Avoid<ConfirmDialog>…form…</ConfirmDialog>
Accessibility
- Inherits Dialog: focus trap, Escape, backdrop dismissal and focus restoration.
- Confirm shows aria-busy while a promise runs; dismissal is blocked.
Content guidelines
Titles
- State the action
- Confirm label repeats the verb
Good examples
- Delete project
- Publish release
Bad examples
- Are you sure?
Composition
Dependencies
What the registry installs alongside this component. Package imports already include these.
npm packages
- class-variance-authority
- clsx
- tailwind-merge
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.