Alert Dialog
A modal that asks the user to confirm or cancel; clicking outside does not dismiss it.
When to use
- Use when
- An action needs an explicit confirm or cancel, such as deleting something.
- Avoid when
- The action is easy to undo; do it, and offer undo instead of asking.
Installation
The source lands in src/components/ui/alert-dialog.tsx, along with any Shelf items it builds on, and .shelf/lock.json records what was installed. It's yours to edit.
Usage
Built on
- Packages
@base-ui/react,@stylexjs/stylex- Shelf items
foundations,utils- Accessibility
- Focus, keyboard, and ARIA behavior come from Base UI.
- Figma
- Optional native Figma library. See Designers.
Verified
- Size
- 1.9 kB gzipped on its own, 24 kB with the Shelf items and packages it builds on. JS and CSS in a production build, without React.
- Accessibility
- Axe passes on 5 stories
- Behavior
- 4 interaction tests in Storybook
- React Compiler
- Compiles with React Compiler
- React Doctor
- React Doctor finds nothing