Components
Alert Dialog
A modal dialog that interrupts the user with important content and expects a response.
Preview
'use client'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/registry/san-francisco/ui/alert-dialog'; import { Button } from '@/registry/san-francisco/ui/button'; export default function AlertDialogDemo() { return ( <AlertDialog> <AlertDialogTrigger render={<Button variant="outline">Delete Account</Button>} /> <AlertDialogContent> <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> <AlertDialogCancel>Cancel</AlertDialogCancel> <AlertDialogAction>Continue</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> ); }
Installation
bunx shadcn@latest add @sft-ui/alert-dialogSizes
Default
'use client'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/registry/san-francisco/ui/alert-dialog'; import { Button } from '@/registry/san-francisco/ui/button'; export default function AlertDialogDemoDefaultSize() { return ( <AlertDialog> <AlertDialogTrigger render={<Button variant="outline">Open Default</Button>} /> <AlertDialogContent size="default"> <AlertDialogHeader> <AlertDialogTitle>Confirm Action</AlertDialogTitle> <AlertDialogDescription>Are you sure you want to proceed?</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Cancel</AlertDialogCancel> <AlertDialogAction>Confirm</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> ); }
Small
'use client'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/registry/san-francisco/ui/alert-dialog'; import { Button } from '@/registry/san-francisco/ui/button'; export default function AlertDialogDemoSmall() { return ( <AlertDialog> <AlertDialogTrigger render={<Button variant="outline">Open Small</Button>} /> <AlertDialogContent size="sm"> <AlertDialogHeader> <AlertDialogTitle>Delete item?</AlertDialogTitle> <AlertDialogDescription>This cannot be undone.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Cancel</AlertDialogCancel> <AlertDialogAction>Delete</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> ); }
API Reference
See the Base UI Alert Dialog documentation for the API reference.