Alert Dialog
Source: packages/shared/components/ui/alert-dialog.tsx
Primitives: @radix-ui/react-alert-dialog
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger,} from "@prosper/shared/components/ui/alert-dialog";Preview
Sub-components
| Component | Description |
|---|---|
AlertDialog | Root — manages open/close state |
AlertDialogTrigger | Element that opens the dialog |
AlertDialogContent | The modal panel (no close X — must use action/cancel) |
AlertDialogHeader | Top section with title and description |
AlertDialogTitle | Heading text |
AlertDialogDescription | Explanatory text |
AlertDialogFooter | Bottom action buttons |
AlertDialogAction | Confirm button (styled as primary) |
AlertDialogCancel | Cancel button (styled as tertiary) |
Difference from Dialog
Unlike Dialog, the AlertDialog has no close button and cannot be dismissed by clicking the overlay — the user must explicitly click Action or Cancel. Use it for destructive or irreversible actions.
Usage Example
<AlertDialog> <AlertDialogTrigger asChild> <Button variant="destructive">Delete Job</Button> </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Are you sure?</AlertDialogTitle> <AlertDialogDescription> This will permanently delete the job posting. This action cannot be undone. </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Cancel</AlertDialogCancel> <AlertDialogAction>Delete</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent></AlertDialog>Used In
- Admin: App.tsx (delete job confirmation dialog)
Notes
- Used with standard styling in the admin app — no className overrides.
- The admin delete confirmation disables both Action and Cancel buttons while the delete operation is in progress (
disabled={isDeleting}).