AlertDialog
A confirmation dialog that stays open until your app confirms the action worked.
Used in Workspace integrations and SaaS admin.
- Use it for
- Confirming a destructive or irreversible action before it happens.
- Not for
- Agent actions that need a reviewed proposal and your server’s confirmation. Try ApprovalCard or Modal.
AlertDialog preview
Open the confirmation to try its focus and cancellation behavior.
Installation
npm install @stackunseen/uiimport { AlertDialog } from '@stackunseen/ui';@stackunseen/ui/styles.cssParts
A confirmation you put together from parts. The action only asks; your app closes the dialog once your server answers.
How the parts fit together
<AlertDialog open={open} onOpenChange={setOpen} busy={pending}>
<AlertDialog.Trigger asChild>
<Button variant="outline">Archive project</Button>
</AlertDialog.Trigger>
<AlertDialog.Content error={error}>
<AlertDialog.Title>Archive project?</AlertDialog.Title>
<AlertDialog.Description>You can restore it from the archive.</AlertDialog.Description>
<AlertDialog.Actions>
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
<AlertDialog.Action onAction={requestArchive}>Archive project</AlertDialog.Action>
</AlertDialog.Actions>
</AlertDialog.Content>
</AlertDialog>AlertDialogHolds the open state.
busystops the action being sent twice.AlertDialog.TriggerOpens the dialog. Pass your own Button with
asChild.AlertDialog.ContentThe dialog.
errorshows a failure your server reported.AlertDialog.TitleSays what will happen, with
AlertDialog.Descriptionunder it.AlertDialog.ActionsHolds Cancel and the action, in that order.
AlertDialog.CancelCloses the dialog without doing anything.
AlertDialog.ActionCalls
onActionand stays open until your server confirms.
Usage and props
Use for a consequential confirmation. Compose Trigger, Content, Title, Description and Actions, with Cancel before Action. Action.onAction starts your request; close the controlled dialog after it succeeds. Show failures through Content.error. A click only asks. Keep the dialog open while your server handles the request, and close it once it confirms. The example here only changes sample data.
openboolean (optional)- Control whether the confirmation is open, especially for asynchronous actions.
onOpenChange(open: boolean) => void (optional)- Update open when the user opens or dismisses the confirmation.
busyboolean (optional)- Disables Action while a request is pending. Cancel remains available.
childrenReactNode (optional)- The compound parts. Action stays open until your application closes the dialog.
All props
Loading…
For your coding agent
Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.
- Contract
- Root: open · onOpenChange · busy? · Content: error? · Action: onAction · Title/Description/Cancel
- Keeps honest
- A click only asks. Keep the dialog open while your server handles the request, and close it once it confirms. The example here only changes sample data.
- MCP
read_component "AlertDialog"on the docs endpoint
Keyboard and customization
Keyboard
Opening focuses Cancel. Tab remains inside; Escape or Cancel dismisses. Busy prevents repeated action requests while cancellation remains available.
Customization
Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio