Skip to content
GitHub (opens in a new tab)

AlertDialog

Must-choose overlay that interrupts until the user cancels or confirms. Composes ModalCard (same header and footer as Modal), with no Close.

stableOrganismcontracts/alertdialog.json

Preview

AlertDialog

Must-choose overlay. Not Alert. Not Modal.

Master

Small danger dialog. Escape cancels; an overlay click does not. Variants shows primary and type to confirm.

Usage

Use Alert for inline status. Use Modal when they can dismiss. Use AlertDialog when they must choose. Escape cancels. Overlay does not close.

Do's

  • Confirming a destructive or irreversible action
  • A decision that must be answered before the page continues

Don'ts

  • Inline status on the page — use Alert
  • Dismissible short tasks or forms — use Modal
  • Passive help — use Tooltip
<AlertDialog
  open={open}
  size="sm"
  tone="warning"
  eyebrow="Integrations"
  title="Disconnect Stripe?"
  description="Syncing stops right away. Invoices already in the ledger stay. You can reconnect later."
  cancelLabel="Keep connected"
  actionLabel="Disconnect"
  actionVariant="danger"
  onCancel={close}
  onAction={confirm}
/>

When to use

  • Confirming a destructive or irreversible action
  • A decision that must be answered before the page continues

When not to use

  • Inline status on the page — use Alert
  • Dismissible short tasks or forms — use Modal
  • Passive help — use Tooltip

What an agent reads

import { AlertDialog } from "agentic-ds-kit";
must
  • Composes ModalCard with role=alertdialog and aria-modal
  • Title (h2) is the accessible name, description is aria-describedby
  • Focus starts on Cancel, or in the confirmText field when set; never on the action
  • confirmText field is labelled, described by a hint until it matches, and aria-invalid on a typo; the action is disabled until it matches
  • consequences are visible text
  • Focus is trapped while open and the page behind is inert
  • Escape cancels, unless an open panel inside it (Select, DatePicker) handles that Escape first
  • Overlay click does not dismiss
  • Scroll lock keeps the scrollbar gutter
  • Focus returns to the opener on close; if the opener is gone, to the page heading (or main)
  • built-in labels (dialogActions, warning, danger, info, success) come from KitLabelsProvider; English by default
  • Below 30rem (480px) it docks to the bottom as a full-width sheet (24 from the sides, 40 from the bottom) with Cancel and the action stacked full width at lg 40, Cancel on top; focus still starts on Cancel
defaults
  • tone neutral
  • cancelLabel Cancel
  • actionVariant primary
  • size md
stops if
  • Do not invent a local confirm dialog or use window.confirm
  • Do not use raw hex
  • Do not put forms, tables, or extra actions in AlertDialog — use Modal
  • Do not add a close X or dismiss on overlay
  • Do not use more than one primary/danger action (the action button is the one)

From contracts/alertdialog.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
openbooleanYes——
titlestringYes——
descriptionstringYes——
eyebrowstringNo—Short area name in the header row, 12px, like Billing · Invoices. Caller-provided.
toneenumNoneutralTone icon (16px, aria-hidden) and status word from KitLabels (info, success, warning, danger) before the eyebrow, so status is never colour alone. neutral shows the eyebrow only. neutral | info | success | warning | danger
consequencesstring[]No—Outcome lines under the description, as visible text, like Invoices already in the ledger stay.
confirmTextstringNo—The person types this (a name) to turn on the action. The field is labelled Type <confirmText> to confirm; the action stays disabled until it matches, and focus starts in the field.
cancelLabelstringNoCancel—
actionLabelstringYes——
actionVariantprimary | dangerNoprimarydanger replaces the primary. Buttons are size sm.
sizesm | mdNomdModal sizes: sm 352 (16 padding) or md 448 (24). Radius 16.
footerStartslotNo—Left of Cancel and the action, first in the footer tab order: an optional Ask Button (appearance outline, mode neutral, size sm, iconStart MessageCircle). Caller-provided label.
onCancelfunctionYes——
onActionfunctionYes——
  • Component
    →

    Alert

    Inline status banner that stays on the page.

  • Component
    →

    Modal

    Dismissible overlay for short tasks, forms, or extra detail.

  • Component
    →

    Tooltip

    Brief supplementary text on hover or focus of a trigger element.