On this page

Alert dialog

When to use an alert dialog, what to use instead, button order, behaviour and tokens.

Draft. Ported from control-center’s Alert dialog (from shadcn-vue) and restyled with Beehexa tokens, 12 November 2026. Not yet approved. It is in the registry so teams can try it; the API may still change before approval.

An alert dialog asks one question and waits for an answer. It interrupts on purpose, so keep it for moments that need it.

When to use

  • Before an action that can’t be undone: delete, disconnect, discard changes.
  • Before an action with a large effect people may not expect, such as re-syncing every order.

When not to use

  • For an action that can be undone. Do it, and offer Undo in a toast.
  • For a task with fields. Use a dialog.
  • To tell people something that needs no answer. Use an inline message or a toast.

Buttons

  • Right-aligned. The action is last, Cancel just before it (D10). In AlertDialogFooter, write AlertDialogCancel, then AlertDialogAction.
  • Name the action with what it does: “Delete mapping”, “Disconnect”. Never “Yes” or “OK”.
  • Use variant="destructive" on the action when it deletes or can’t be undone.
  • Name Cancel “Cancel”, or with what it keeps: “Keep editing”.

Behaviour

  • Cancel takes focus when the dialog opens, so pressing Enter by habit does nothing harmful.
  • Closes on either button or Esc, which cancels. A click on the scrim does not close it. There is no close button in the corner.
  • Focus returns to the trigger when it closes.
  • size="default" is 384 px wide at most (size.dialog.small), with the text left-aligned on wider screens. size="sm" is 320 px (size.dialog.xsmall), centred, with the buttons side by side.

Content

  • The title is the question: “Delete this mapping?”
  • The description says what happens and what does not: “Records already synced stay as they are. You can’t undo this.”

Tokens

Part Tokens
Scrim color.surface.scrim
Surface color.surface.overlay, elevation.shadow.modal
Layer z-index.modal
Corners radius.modal (12 px)
Padding, gap space.modal (24 px), space.modal.gap
Title font.heading.medium, color.text
Description font.body.default, color.text.subtle
Media size.control.large (40 px) tile, radius.control, color.background.neutral; icon size.icon.large
Footer On the dialog surface, no band or line, space.modal.gap below the body; 8 px between buttons
  • Dialog: a task with fields.
  • Button: the Danger button and button order.