Alert Dialog

A modal dialog that requires user response to proceed.

import {
  AlertDialog,
  AlertDialogClose,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog/alert-dialog";
import { Button } from "@/components/ui/button/button";
import styles from "./alert-dialog-demo.module.css";

export default function AlertDialogDemo() {
  return (
    <AlertDialog>
      <AlertDialogTrigger
        render={<Button variant="destructive">Delete Account</Button>}
      />

      <AlertDialogContent className={styles.content}>
        <AlertDialogHeader>
          <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
          <AlertDialogDescription className={styles.description}>
            This action cannot be undone.
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter className={styles.footer}>
          <AlertDialogClose
            render={<Button variant="outline">Cancel</Button>}
          />
          <Button variant="destructive">Delete Account</Button>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
}
npx shadcn@latest add https://roiui.com/r/alert-dialog.json
anatomy
<AlertDialog>
  <AlertDialogTrigger />
  <AlertDialogContent>
      <AlertDialogHeader>
          <AlertDialogTitle />
          <AlertDialogDescription />
      </AlertDialogHeader>
      <AlertDialogFooter>
          <AlertDialogClose />
      </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>