apps/design-system/content/docs/fragments/confirmation-modal.mdx
Confirmation Modal is a convenience wrapper for confirmation flows that are more complex than a single paragraph but do not warrant a full custom dialog. It is built on top of Dialog and provides a prop-based API for consistent confirmation patterns.
Use Confirmation Modal when the user needs extra context to make a decision, such as explanatory copy, callouts, or small form elements, and the action is not so destructive that it requires typed confirmation.
If the confirmation can be expressed as a single short paragraph, use Alert Dialog. If the action is highly destructive and requires explicit typed intent, use Text Confirm Dialog. See Modality for broader guidance on choosing the appropriate pattern.
For dirty-form dismissal in dialogs/sheets, use the dedicated discard-confirmation pattern (DiscardChangesConfirmationDialog + useConfirmOnClose) instead of ConfirmationModal. Avoid creating custom wrapper components for this flow; wire modalProps from useConfirmOnClose directly into DiscardChangesConfirmationDialog.
'use client'
import { useState } from 'react'
import { Button } from 'ui'
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
export default function ConfirmationModalDemo() {
const [visible, setVisible] = useState(false)
return (
<>
<Button onClick={() => setVisible(true)}>Show Confirmation Modal</Button>
<ConfirmationModal
visible={visible}
size="small"
title="Resume this project"
confirmLabel="Resume"
confirmLabelLoading="Resuming"
cancelLabel="Cancel"
onConfirm={() => {
setVisible(false)
}}
onCancel={() => {
setVisible(false)
}}
>
This will resume the project and restart any paused processes.
</ConfirmationModal>
</>
)
}
DiscardChangesConfirmationDialog for unsaved-changes prompts so copy, behavior, and wiring stay consistent across dialogs/sheets.visible: Controls open statetitle: Dialog titledescription: Optional descriptionvariant: 'default' | 'destructive' | 'warning'loading: Loading stateonConfirm: Confirm handleronCancel: Cancel handleralert: Optional callout (see Admonition)children: Additional content