Customized Footer Alert Dialog

PreviousNext

An alert dialog with customized footer

Docs
shadcnui-blockscomponent

Preview

Loading preview…
components/customized/alert-dialog/alert-dialog-06.tsx
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/registry/ui/alert-dialog";
import { Button, buttonVariants } from "@/registry/ui/button";
import { ExternalLink, OctagonAlert, Trash, X } from "lucide-react";

export default function AlertDialogWithCustomizedFooter() {
  return (
    <AlertDialog>
      <AlertDialogTrigger asChild>
        <Button variant="outline">Show Dialog</Button>
      </AlertDialogTrigger>
      <AlertDialogContent className="overflow-hidden">
        <AlertDialogHeader className="pb-4">
          <AlertDialogTitle>
            <div className="mx-auto sm:mx-0 mb-4 flex h-9 w-9 items-center justify-center rounded-full bg-destructive/10">
              <OctagonAlert className="h-5 w-5 text-destructive" />
            </div>
            Are you absolutely sure?
          </AlertDialogTitle>
          <AlertDialogDescription className="text-[15px]">
            This action cannot be undone. This will permanently delete your
            account and remove your data from our servers.
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter className="border-t -mx-6 -mb-6 px-6 py-5">
          <Button
            variant="link"
            className="-ml-3 mr-auto text-muted-foreground"
          >
            Learn more <ExternalLink />
          </Button>
          <AlertDialogCancel>
            <X /> Cancel
          </AlertDialogCancel>
          <AlertDialogAction
            className={buttonVariants({ variant: "destructive" })}
          >
            <Trash />
            Continue
          </AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
}

Installation

npx shadcn@latest add @shadcnui-blocks/alert-dialog-06

Usage

import { AlertDialog06 } from "@/components/alert-dialog-06"
<AlertDialog06 />