Usage
onConfirm. Do not assemble a confirm from AlertDialog parts in a page.
title, description, confirmLabel, and cancelLabel are required LocalizedMessage props. Name the affected thing in description ("This removes incident 4521 and its notes. It cannot be undone."), and name the confirm for its action ("Delete", "Remove", "End shift"), never "Confirm" or "OK". The cancel is "Cancel" by default; use a domain-specific label such as "Keep incident" only where the copy is about that domain. A prompt that appears when a dirty form closes uses "Keep editing" for the cancel and "Discard" for the confirm (ADR 0023, decision 10). pendingLabel ("Deleting incident") names the confirm Button and is announced while a confirm is pending.
ConfirmDialogVariant.Destructive paints a destructive solid confirm for an irreversible action. The default paints an accent solid confirm. Focus starts on the cancel in both.
Return a promise from onConfirm and the block does the rest:
onOpenChange is called with close-press. If the caller vetoes that close, the dialog stays open and focus returns to the confirm Button.error:trigger opens the dialog and defaultOpen opens it on mount. Controlled, pass open and onOpenChange, as a list page does with one shared dialog and the row it picked. onOpenChange(false, details) is called for the cancel, a fulfilled confirm, and Escape; details.cancel() keeps it open. A backdrop press never closes it.
children renders between the description and the actions: the records an action affects. A typed confirmation field sits below it.
For an action that is hard to undo, ask the person to type what they are deleting. Pass confirmation={ConfirmDialogConfirmation.Typed}, the phrase to type, and the sentence around it:
phrase is the record's name, so the person types the name of the record they are about to delete.phrase is a fixed word the product picks once (such as DELETE), whatever the count.instruction, then the phrase, then instructionEnd, as one sentence ("To continue, type User Permissions in the field below."). The block places the phrase so it can set it apart, so do not repeat it in either part. Name the confirm for the action ("Delete", not "Confirm") and the cancel "Cancel" or what it keeps. All copy is LocalizedMessage; the phrase is data.children renders above the field, so list the records an action affects there.confirmDisabled still works and combines with the match: the confirm is available only when both allow it.
Load the stylesheets of what it composes: alert-dialog/styles.css, dialog/styles.css, button/styles.css, text/styles.css, box/styles.css, and visually-hidden/styles.css, with blocks/confirm-dialog/styles.css. A typed dialog also needs input/styles.css and label/styles.css.