Back to Components

Overlay

AlertDialog

Confirmation modal for destructive or irreversible actions. role='alertdialog' and overlay-click is disabled — the user must explicitly choose.

Examples

Confirm

(no choice yet)
<Button onclick={() => open = true}>Confirm action</Button>
<AlertDialog
  bind:open
  title="Save changes?"
  description="Your edits will be published to the live site."
  onConfirm={() => result = 'confirmed'}
  onCancel={() => result = 'cancelled'}
/>

tone="danger"

<AlertDialog
  bind:open
  tone="danger"
  title="Delete library?"
  description="This permanently removes 1,204 books and 8,421 passages."
  confirmLabel="Delete"
/>

Props

PropTypeDefaultDescription
openbooleanfalseBindable open state.
titlestringHeading text.
descriptionstringBody text — replaces the children slot for AlertDialog.
confirmLabelstring'Confirm'Label for the action button.
cancelLabelstring'Cancel'Label for the dismiss button.
tone'default' | 'danger''default''danger' colors the confirm button red.
onConfirm() => voidCalled when Confirm is clicked.
onCancel() => voidCalled when Cancel is clicked.

Install

CLI

npm install bits-ui
npx @a3tai/mittsu add alert-dialog