GitHub

Confirmation Dialog

Destructive action dialog requiring text confirmation

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { ConfirmationDialog } from "@corew500/ui/confirmation-dialog"

<ConfirmationDialog>Content</ConfirmationDialog>

API Reference

Props

PropTypeDefaultDescription
open*enumWhether the dialog is open
onOpenChange*(open: boolean) => voidCallback when open state changes
title*stringDialog title text
descriptionstringDialog description text
confirmPhrase*stringThe exact phrase the user must type to enable the action button
confirmLabelstringConfirmLabel for the action button
cancelLabelstringCancelLabel for the cancel button
inputLabelenumCustom label for the confirmation input. Defaults to "Type {phrase} to confirm"
inputPlaceholderstringPlaceholder text for the confirmation input
variantenumdestructiveVisual variant affecting the action button and warnings styling
onConfirm*() => void | Promise<void>Callback when the action is confirmed. Can return a Promise for async operations.
loadingenumExternal loading state. When provided, overrides internal loading management.
iconenumOptional icon displayed in the dialog header
warningsstring[]Optional list of warning messages displayed above the confirmation input
sizeenumdefaultDialog size variant
classNamestringAdditional CSS classes for the dialog content

Accessibility

Focus Management

  • Focus trapped within dialog when open
  • Confirmation input receives focus when dialog opens

Screen Readers

  • - Inherits AlertDialog ARIA: role="alertdialog", aria-labelledby, aria-describedby
  • Live region announces loading state

Additional

  • Action button clearly indicates disabled state

Localization

Translatable Content

  • - All text props should be pre-translated
  • `inputLabel`, `confirmLabel`, `cancelLabel`, `inputPlaceholder` are customizable

Additional

  • `confirmPhrase` is displayed to the user and used for matching

Related

Related Components