Confirmation
A destructive-action guard with a static backdrop, a pending state and a confirm button that is never focused first.
Live preview
Source
The exact file rendered in the preview above.
components/demos/confirm-dialog.tsx
components/ui/dialog.tsx
Demo source — adapt to your project. Foundry is not published as a package.
Usage
For irreversible actions. Two details do the real work: the backdrop cannot dismiss it, and the confirm button is not the initially focused element — so a stray Enter cannot delete anything.
- Name the object in the title: "Delete Acme Platform?" beats "Are you sure?".
- Say what will be lost, in the description, before asking for confirmation.
- Prefer an undo Toast for anything genuinely reversible; a confirmation costs every user time to protect a few.
Variants and states
Every entry below is a genuine difference in behaviour or layout, and every one of them is visible in the preview above.
- Danger
- Accent
- Loading
- Custom labels
Accessibility
- Initial focus
- Focus lands on the first focusable element, which is Cancel.
- Busy state
- The confirm button reports `aria-busy` while pending, and both buttons are disabled.
Foundry implements published ARIA patterns and is tested against them. No WCAG certification is claimed — see the accessibility documentation for what is and is not covered.
Related
All componentsDialog
A modal with focus trapping, scroll locking, Escape dismissal and focus return — in four sizes.
advancedFeatured5 variantsButton
The complete action surface: nine variants, five sizes, and a loading state that preserves the control’s measured width.
starterFeatured7 variantsToast
Transient notifications in a single polite live region, with pinned errors and an optional undo action.
intermediateFeatured6 variants