DDS/Components/Alert Dialog

Alert Dialog

Overlay

A confirmation modal with a Cancel and Confirm action. Use it for destructive or irreversible operations.

Props

PropTypeDefaultDescription
modelValue*booleanfalseOpen state (v-model).
titlestring"Are you sure?"Dialog title.
descriptionstringDialog description (also default slot).
confirmLabelstring"Confirm"Label for confirm button.
cancelLabelstring"Cancel"Label for cancel button.
variant"default" | "destructive""default"Changes the confirm button style.
loadingbooleanfalseShows loading state on confirm button.

Examples

Default
vue
<script setup>
const open = ref(false)
</script>
<template>
  <DsButton @click="open = true">Delete account</DsButton>
  <DsAlertDialog
    v-model="open"
    title="Delete account?"
    description="This will permanently delete your account and all data."
    confirm-label="Delete"
    cancel-label="Cancel"
    variant="destructive"
    @confirm="open = false"
    @cancel="open = false"
  />
</template>
Destructive
vue
<script setup>
const open = ref(false)
</script>
<template>
  <DsButton @click="open = true">Delete account</DsButton>
  <DsAlertDialog
    v-model="open"
    title="Delete account?"
    description="This will permanently delete your account and all data."
    confirm-label="Delete"
    cancel-label="Cancel"
    variant="destructive"
    @confirm="open = false"
    @cancel="open = false"
  />
</template>

Skeleton

Use DsAlertDialogSkeleton as a loading placeholder while content is being fetched.

Default
vue
<DsAlertDialogSkeleton />

Accessibility

  • role="alertdialog" with aria-modal="true".
  • ESC key closes the dialog.
  • Backdrop click cancels.
  • Focus trap inside the dialog.