Skip to content

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

ComponentDescription
AlertDialogRoot — manages open/close state
AlertDialogTriggerElement that opens the dialog
AlertDialogContentThe modal panel (no close X — must use action/cancel)
AlertDialogHeaderTop section with title and description
AlertDialogTitleHeading text
AlertDialogDescriptionExplanatory text
AlertDialogFooterBottom action buttons
AlertDialogActionConfirm button (styled as primary)
AlertDialogCancelCancel 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}).