Hacktron Design System

AlertDialog

A modal that interrupts the user and demands an explicit decision — confirm or cancel — before they can continue.

<template>
  <AlertDialog v-model:open="open" title="Delete repository" description="This will permanently delete the repository and all of its scan history. This can't be undone.">
    <template #cancel>
      <Button variant="ghost">Cancel</Button>
    </template>
    <template #action>
      <Button variant="destructive" @click="onConfirm">Delete</Button>
    </template>
  </AlertDialog>
</template>

Props

Name Type Default
openboolean (v-model:open)false
titlestring
descriptionstring

Slots

Name Description
bodyOptional extra content between the description and the actions — keep it short, this isn't a form.
cancelRequired. Wrapped in reka-ui's AlertDialogCancel (as-child) — put a single <Button> here, e.g. variant="ghost". Closes on click and is where focus lands when the dialog opens.
actionRequired. Wrapped in reka-ui's AlertDialogAction (as-child) — put a single <Button> here, e.g. variant="destructive" for a delete/remove. Closes on click; add your own @click handler alongside for the actual confirm logic.
titleEscape hatch: replaces the `title` prop's plain text.
descriptionEscape hatch: replaces the `description` prop's plain text.

Usage

Examples

Basic

A destructive action the user must explicitly confirm or cancel — no dismiss-and-forget.

const open = ref(false)

<Button variant="secondary" @click="open = true">Delete account</Button>
<AlertDialog v-model:open="open" title="Delete account" description="This will permanently delete your account and remove all of your data. This can't be undone.">
  <template #cancel>
    <Button variant="ghost">Cancel</Button>
  </template>
  <template #action>
    <Button variant="destructive" @click="onConfirm">Delete</Button>
  </template>
</AlertDialog>