ConfirmationModal
A pre-built confirmation dialog with Confirm and Cancel buttons. Use it for destructive or irreversible actions (delete, deactivate, etc.).
π StorybookPreviewβ
Live previewβ Open in Storybook
Importβ
import { ConfirmationModal } from "@xocialive/ui-components";
Basic usageβ
const { open, onOpen, onClose } = useDisclosure();
<Button color="error" onClick={onOpen}>Delete</Button>
<ConfirmationModal
open={open}
onClose={onClose}
onConfirm={async () => {
await deleteItem(item.id);
onClose();
}}
title="Delete item?"
message="This action cannot be undone."
confirmLabel="Delete"
confirmColor="error"
/>
Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | β | Controls visibility |
onClose | () => void | β | Cancel / close handler |
onConfirm | () => void | Promise<void> | β | Confirm handler |
title | string | β | Dialog title |
message | string | β | Body message |
confirmLabel | string | "Confirm" | Confirm button label |
cancelLabel | string | "Cancel" | Cancel button label |
confirmColor | MuiButtonColor | "primary" | Confirm button colour |
isLoading | boolean | false | Disables buttons and shows spinner |