ConfirmDialog

A modal confirmation dialog for actions that require explicit user approval. Supports default, danger, and warning variants that style the confirm button accordingly. Handles async confirm callbacks with automatic loading state.

Import

import { ConfirmDialog } from '@wavebooking/aqua-fusion';

Preview

Loading preview...

Usage

const [open, setOpen] = useState(false);
 
<ConfirmDialog
  open={open}
  onClose={() => setOpen(false)}
  onConfirm={async () => {
    await deleteItem();
    setOpen(false);
  }}
  title="Delete lesson"
  description="Are you sure you want to delete this lesson? This action cannot be undone."
  variant="danger"
  confirmText="Delete"
/>

Props

PropTypeDefaultDescription
open*boolean-Whether the dialog is open.
onClose*() => void-Callback when the dialog should close.
onConfirm*() => void | Promise<void>-Callback when the user confirms. Async functions show a loading spinner automatically.
title*string-Dialog title text.
descriptionstring-Dialog description text shown below the title.
childrenReactNode-Additional content rendered in the dialog body.
confirmTextstring'Confirm'Label for the confirm button.
cancelTextstring'Cancel'Label for the cancel button.
variant'default' | 'danger' | 'warning''default'Visual variant that controls confirm button styling.
loadingbooleanfalseExternal loading state for the confirm button.
disabledbooleanfalseWhether the confirm button is disabled.
iconReactNode-Icon displayed in the header area.
classNamestring-Additional CSS class for the dialog.