Docs
警告对话框

警告对话框

使用重要内容中断用户的模式对话框并等待响应。

安装

npx shadcn-ui@latest add alert-dialog

用法

import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
<AlertDialog>
  <AlertDialogTrigger>打开</AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>您绝对确定要执行此操作吗?</AlertDialogTitle>
      <AlertDialogDescription>
        此操作不可撤销。它将永久删除您的帐户并从我们的服务器中删除您的数据。
      </AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>取消</AlertDialogCancel>
      <AlertDialogAction>继续</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>