Skip to main content

ConfirmationModal

A pre-built confirmation dialog with Confirm and Cancel buttons. Use it for destructive or irreversible actions (delete, deactivate, etc.).

πŸ“– Storybook

Preview​

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​

PropTypeDefaultDescription
openbooleanβ€”Controls visibility
onClose() => voidβ€”Cancel / close handler
onConfirm() => void | Promise<void>β€”Confirm handler
titlestringβ€”Dialog title
messagestringβ€”Body message
confirmLabelstring"Confirm"Confirm button label
cancelLabelstring"Cancel"Cancel button label
confirmColorMuiButtonColor"primary"Confirm button colour
isLoadingbooleanfalseDisables buttons and shows spinner