Overlay

Alert Dialog

Interrupts the flow for confirmations that can change or discard user data.

Imports

Use the same component slug for React, Vue, and style token lookup. Do not import components from package roots.

import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogAction, AlertDialogCancel } from "@line/abc-def-react/alert-dialog";
<script setup lang="ts">
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogAction, AlertDialogCancel } from "@line/abc-def-vue/alert-dialog";
</script>

Shadcn references

Compare the corresponding shadcn React and Vue documentation for the same component slug.

Basic usage

import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@line/abc-def-react/alert-dialog";
import { Button } from "@line/abc-def-react/button";

export function Example() {
  return (
    <AlertDialog>
      <AlertDialogTrigger asChild>
        <Button variant="destructive">Delete draft</Button>
      </AlertDialogTrigger>
      <AlertDialogContent>
        <AlertDialogHeader>
          <AlertDialogTitle>Delete draft?</AlertDialogTitle>
          <AlertDialogDescription>This action cannot be undone.</AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel>Cancel</AlertDialogCancel>
          <AlertDialogAction>Delete</AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
}
<script setup lang="ts">
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@line/abc-def-vue/alert-dialog";
import { Button } from "@line/abc-def-vue/button";
</script>

<template>
  <AlertDialog>
    <AlertDialogTrigger :as-child="true">
      <Button variant="destructive">Delete draft</Button>
    </AlertDialogTrigger>
    <AlertDialogContent>
      <AlertDialogHeader>
        <AlertDialogTitle>Delete draft?</AlertDialogTitle>
        <AlertDialogDescription>
          This action cannot be undone.
        </AlertDialogDescription>
      </AlertDialogHeader>
      <AlertDialogFooter>
        <AlertDialogCancel>Cancel</AlertDialogCancel>
        <AlertDialogAction>Delete</AlertDialogAction>
      </AlertDialogFooter>
    </AlertDialogContent>
  </AlertDialog>
</template>

Component tokens

Component TokenSemantic TokenDefault Primitive Token
--alert-dialog-overlay-bgLiteral valuergb(0 0 0 / 0.1)
--alert-dialog-content-bg--popover--color-white
--alert-dialog-content-fg--popover-foreground--color-zinc-950
--alert-dialog-content-ring--foreground--color-zinc-950
--alert-dialog-footer-bg--muted--color-zinc-100
--alert-dialog-footer-border--border--color-zinc-200
--alert-dialog-media-bg--muted--color-zinc-100
--alert-dialog-description-fg--muted-foreground--color-zinc-500

Composition exports

AlertDialogAlertDialogTriggerAlertDialogContentAlertDialogActionAlertDialogCancel

Usage notes

  • Reserve for destructive or irreversible actions.
  • Always provide a cancel path.
  • Related component tokens use the `alert-dialog` token group in `@line/abc-def-styles/css`.