Skip to Content

Confirmation Modal

ConfirmationModal is a generic confirmation dialog for destructive or irreversible actions like deletion. Requires explicit user confirmation before proceeding.


Import

import { ConfirmationModal } from "@phpcreation/frontend-crud-react-nextjs-bundle/components/ConfirmationModal";

Usage

import { ConfirmationModal } from "..."; <ConfirmationModal open={deleteOpen} onOpenChange={setDeleteOpen} title="Delete Invoice" description="This will permanently delete the invoice. This action cannot be undone." confirmLabel="Delete" confirmVariant="destructive" onConfirm={async () => { await deleteInvoice(entity.id); setDeleteOpen(false); router.push("/invoices"); }} />

Props

PropTypeDefaultDescription
openbooleanModal open state
onOpenChange(open: boolean) => voidOpen state handler
titlestring"Are you sure?"Dialog title
descriptionstringWarning text
confirmLabelstring"Confirm"Confirm button label
cancelLabelstring"Cancel"Cancel button label
confirmVariantButtonVariant"default"Confirm button variant
onConfirm() => void | Promise<void>Confirm action
loadingbooleanfalseShow spinner on confirm button

Last updated on