Skip to content

Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Documentation navigation

Components / Overlays

AlertDialog

A confirmation modal that initially focuses its cancel action.

Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.

Interactive showcase

Delete “Aurora launch”?

This permanently removes the project, its 24 tasks, and all shared files. This action cannot be undone.

A

Aurora launch

Updated 12 minutes ago

Install

Run in your project
bunx --bun @getweini/cli@latest add alert-dialog

Start with this example

Import the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.

Delete this project?

The project and its files will be removed.

Vue
<script setup lang="ts">
import AlertDialog from './components/ui/alert-dialog/AlertDialog.vue'
import AlertDialogAction from './components/ui/alert-dialog/AlertDialogAction.vue'
import AlertDialogCancel from './components/ui/alert-dialog/AlertDialogCancel.vue'
import AlertDialogContent from './components/ui/alert-dialog/AlertDialogContent.vue'
import AlertDialogDescription from './components/ui/alert-dialog/AlertDialogDescription.vue'
import AlertDialogFooter from './components/ui/alert-dialog/AlertDialogFooter.vue'
import AlertDialogHeader from './components/ui/alert-dialog/AlertDialogHeader.vue'
import AlertDialogTitle from './components/ui/alert-dialog/AlertDialogTitle.vue'
import AlertDialogTrigger from './components/ui/alert-dialog/AlertDialogTrigger.vue'
</script>
<template>
  <AlertDialog>
    <AlertDialogTrigger>Delete project</AlertDialogTrigger>
    <AlertDialogContent>
      <AlertDialogHeader>
        <AlertDialogTitle>Delete this project?</AlertDialogTitle>
        <AlertDialogDescription>The project and its files will be removed.</AlertDialogDescription>
      </AlertDialogHeader>
      <AlertDialogFooter>
        <AlertDialogCancel>Cancel</AlertDialogCancel>
        <AlertDialogAction @click="$emit('delete')">Delete project</AlertDialogAction>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>
</template>

Clicking the backdrop does not dismiss an alert dialog. Use AlertDialogHeader’s #icon slot to place an icon beside the title. The body scrolls when content is long, and focus starts on Cancel.

When to use it

Confirm deletion

Ask for an explicit decision before removing data that cannot be recovered.

Confirm broad changes

Explain the scope of a high-impact update before applying it.

More examples

Delete a project

Cancel receives initial focus.

Delete a project
<script setup lang="ts">
import AlertDialog from './components/ui/alert-dialog/AlertDialog.vue'
import AlertDialogAction from './components/ui/alert-dialog/AlertDialogAction.vue'
import AlertDialogCancel from './components/ui/alert-dialog/AlertDialogCancel.vue'
import AlertDialogContent from './components/ui/alert-dialog/AlertDialogContent.vue'
import AlertDialogDescription from './components/ui/alert-dialog/AlertDialogDescription.vue'
import AlertDialogFooter from './components/ui/alert-dialog/AlertDialogFooter.vue'
import AlertDialogHeader from './components/ui/alert-dialog/AlertDialogHeader.vue'
import AlertDialogTitle from './components/ui/alert-dialog/AlertDialogTitle.vue'
import AlertDialogTrigger from './components/ui/alert-dialog/AlertDialogTrigger.vue'
</script>
<template>
  <AlertDialog>
    <AlertDialogTrigger>Delete project</AlertDialogTrigger>
    <AlertDialogContent>
      <AlertDialogHeader>
        <AlertDialogTitle>Delete this project?</AlertDialogTitle>
        <AlertDialogDescription>The project and its files will be removed.</AlertDialogDescription>
      </AlertDialogHeader>
      <AlertDialogFooter>
        <AlertDialogCancel>Cancel</AlertDialogCancel>
        <AlertDialogAction @click="$emit('delete')">Delete project</AlertDialogAction>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>
</template>

Confirm bulk update

Use controlled state when the parent coordinates the operation.

Confirm bulk update
<script setup lang="ts">
import { ref } from 'vue'
import AlertDialog from './components/ui/alert-dialog/AlertDialog.vue'
import AlertDialogAction from './components/ui/alert-dialog/AlertDialogAction.vue'
import AlertDialogCancel from './components/ui/alert-dialog/AlertDialogCancel.vue'
import AlertDialogContent from './components/ui/alert-dialog/AlertDialogContent.vue'
import AlertDialogDescription from './components/ui/alert-dialog/AlertDialogDescription.vue'
import AlertDialogFooter from './components/ui/alert-dialog/AlertDialogFooter.vue'
import AlertDialogHeader from './components/ui/alert-dialog/AlertDialogHeader.vue'
import AlertDialogTitle from './components/ui/alert-dialog/AlertDialogTitle.vue'
import AlertDialogTrigger from './components/ui/alert-dialog/AlertDialogTrigger.vue'

const open = ref(false)
</script>
<template>
  <AlertDialog v-model:open="open">
    <AlertDialogTrigger>Publish all</AlertDialogTrigger>
    <AlertDialogContent>
      <AlertDialogHeader>
        <AlertDialogTitle>Publish all drafts?</AlertDialogTitle>
        <AlertDialogDescription>
          Every draft will become visible to your team.
        </AlertDialogDescription>
      </AlertDialogHeader>
      <AlertDialogFooter>
        <AlertDialogCancel>Keep drafts</AlertDialogCancel>
        <AlertDialogAction @click="$emit('publish')">Publish all</AlertDialogAction>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>
</template>

Complete API

Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.

AlertDialog

Complete API for AlertDialog
NameType or signatureDefaultWhat it does
openmodelboolean | undefinedNot setCurrent open state. Use v-model:open to keep it in sync with your page.
defaultOpenpropboolean | undefinedfalseStarting open state when the parent does not control open.
disabledpropboolean | undefinedfalsePrevent interaction and show the disabled state.
update:openevent[open: boolean]—Requests a new open value from the parent.
openChangeevent[open: boolean]—Emitted after this value or state changes.
defaultslot{}OptionalContent shown inside AlertDialog.

AlertDialogAction

Complete API for AlertDialogAction
NameType or signatureDefaultWhat it does
asChildpropboolean | undefinedNot setUse one child element as the control instead of adding another wrapper.
defaultslot{}OptionalContent shown inside AlertDialogAction.

AlertDialogBody

Complete API for AlertDialogBody
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside AlertDialogBody.

AlertDialogCancel

Complete API for AlertDialogCancel
NameType or signatureDefaultWhat it does
asChildpropboolean | undefinedNot setUse one child element as the control instead of adding another wrapper.
defaultslot{}OptionalContent shown inside AlertDialogCancel.

AlertDialogContent

Complete API for AlertDialogContent
NameType or signatureDefaultWhat it does
fullscreenpropboolean | undefinedfalseFill the available viewport with the dialog content.
sizepropDialogSize | undefined"md"Choose the visual size. Medium is the usual default where available.
dismissOnBackdroppropboolean | undefinedfalseAllow a click outside the dialog content to close it.
persistentpropboolean | undefinedNot setKeep the dialog open when the backdrop is clicked.
defaultslot{}OptionalContent shown inside AlertDialogContent.

AlertDialogDescription

Complete API for AlertDialogDescription
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside AlertDialogDescription.

AlertDialogFooter

Complete API for AlertDialogFooter
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside AlertDialogFooter.

AlertDialogHeader

Complete API for AlertDialogHeader
NameType or signatureDefaultWhat it does
defaultslot() => unknownRequiredContent shown inside AlertDialogHeader.
iconslot(() => unknown) | undefinedOptionalContent for the icon area of AlertDialogHeader.
actionsslot(() => unknown) | undefinedOptionalContent for the actions area of AlertDialogHeader.

AlertDialogTitle

Complete API for AlertDialogTitle
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside AlertDialogTitle.

AlertDialogTrigger

Complete API for AlertDialogTrigger
NameType or signatureDefaultWhat it does
disabledpropboolean | undefinedfalsePrevent interaction and show the disabled state.
asChildpropboolean | undefinedNot setUse one child element as the control instead of adding another wrapper.
defaultslot{}OptionalContent shown inside AlertDialogTrigger.
Public type definitions
Public types
// packages/frameworks/vue/components/alert-dialog/types.ts
// ------- IMPORTS -------

import type { DialogContentProps, DialogProps, DialogTriggerProps } from '../dialog/types'

// ------- TYPES -------

export type AlertDialogProps = DialogProps
export type AlertDialogContentProps = DialogContentProps
export type AlertDialogTriggerProps = DialogTriggerProps


// packages/frameworks/vue/components/dialog/types.ts
// ------- TYPES -------

export type DialogSize = 'sm' | 'md' | 'lg' | 'xl'

export interface DialogProps {
  open?: boolean
  defaultOpen?: boolean
  disabled?: boolean
}

export interface DialogContentProps {
  fullscreen?: boolean
  size?: DialogSize
  dismissOnBackdrop?: boolean
  persistent?: boolean
}

export interface DialogTriggerProps {
  disabled?: boolean
  asChild?: boolean
}

export interface DialogCloseProps {
  asChild?: boolean
}

Implementation notes

  • AlertDialogAction and AlertDialogCancel close the surface; application code performs the actual operation.
  • Backdrop dismissal is disabled by default so an accidental click does not confirm or discard the decision.

Accessibility and localization

  • Explain the consequence in the title and description, including any icon meaning.
  • The cancel control receives initial focus and Escape returns focus to the trigger.

Source contract and editing guidance