AlertDialog

Markdown

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/ui
import { AlertDialog } from '@stackunseen/ui';
Styles: @stackunseen/ui/styles.css

Parts

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

tsx
<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>
  1. AlertDialog

    Holds the open state. busy stops the action being sent twice.

    Propsbusy

  2. AlertDialog.Trigger

    Opens the dialog. Pass your own Button with asChild.

  3. AlertDialog.Content

    The dialog. error shows a failure your server reported.

    Propserror container

  4. AlertDialog.Title

    Says what will happen, with AlertDialog.Description under it.

  5. AlertDialog.Actions

    Holds Cancel and the action, in that order.

  6. AlertDialog.Cancel

    Closes the dialog without doing anything.

    Propsvariant size

  7. AlertDialog.Action

    Calls onAction and stays open until your server confirms.

    PropsonAction variant size

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
Open the Markdown file

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