Components
AlertDialog
Confirmation dialog requiring explicit user action before proceeding.
AlertDialog
A confirmation dialog that requires an explicit user decision. Unlike Dialog, it cannot be dismissed by clicking the overlay. Built on Base UI AlertDialog with Motion animations.
Import
import { AlertDialog, AlertDialogTrigger, AlertDialogPortal, AlertDialogBackdrop, AlertDialogPopup, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogClose } from '@mks2508/mks-ui/react';Basic Usage
<AlertDialog>
<AlertDialogTrigger>
<Button variant="destructive">Delete Account</Button>
</AlertDialogTrigger>
<AlertDialogPortal>
<AlertDialogBackdrop />
<AlertDialogPopup>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your account
and remove your data from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogClose>
<Button variant="outline">Cancel</Button>
</AlertDialogClose>
<Button variant="destructive">Yes, delete my account</Button>
</AlertDialogFooter>
</AlertDialogPopup>
</AlertDialogPortal>
</AlertDialog>Animation Direction
The AlertDialogPopup accepts a from prop to control the 3D flip animation:
<AlertDialogPopup from="top"> {/* Flips in from top */}
<AlertDialogPopup from="bottom"> {/* Flips in from bottom */}API Reference
| Component | Key Props | Description |
|---|---|---|
AlertDialog | open, defaultOpen, onOpenChange | Root provider |
AlertDialogTrigger | asChild | Trigger element |
AlertDialogPortal | — | Portal with AnimatePresence |
AlertDialogBackdrop | transition, slots | Animated backdrop overlay |
AlertDialogPopup | from, transition, slots | Modal content with flip animation |
AlertDialogHeader | slots | Header layout |
AlertDialogTitle | slots | Title text |
AlertDialogDescription | slots | Description text |
AlertDialogFooter | slots | Footer with actions |
AlertDialogClose | slots | Close trigger |