For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt, and this page is available as Markdown at https://wallarm.github.io/design-system/patterns/confirmation-dialogs.md.

Confirmation dialogs

Components: Dialog, Drawer, Button, Input, Toast, Toaster

A confirmation dialog asks one question about one action, then runs that action or cancels it. Compose it from Dialog parts. There is no ConfirmDialog, AlertDialog, useConfirm or UnsavedChangesDialog.

When to use

NeedUseNot
Delete, revoke, deactivate, disableDialog width={400}, confirm color='destructive'A toast with Undo, or a Switch that silently removes access
Activate or enableDialog width={400}, default brand confirmcolor='destructive'
Delete that also breaks linked objectsType-to-confirm: no width (560) + InputA longer description
Closing a drawer with unsaved editsUnsaved-changes guard, no width (560)window.confirm or closeOnEscape={false}
Continue despite a warningDialog width={400}, brand "Create anyway"An Alert to dismiss first
Reversible action that loses no dataNo dialog; run it and show a toastA confirmation
Several fields before actingCreate and edit formsA form inside DialogBody
Report the resultA toastA second dialog that says "Done"

Rules

Structure

  • Import every Dialog* part from @wallarm-org/design-system/Dialog. Dialog is not exported from the package root.
  • Use width={400} for delete, state change and proceed-anyway. Omit width (560) for type-to-confirm and unsaved changes. Never use 960 for a confirmation.
  • Write the width as a number; DIALOG_SIZES and a size prop do not exist. If the description wraps, keep 400.
  • Footer order, left to right: Cancel, then confirm. The confirm button is always rightmost.
  • Confirm buttons use the default variant='primary'. Every other footer button is variant='ghost' color='neutral'.
  • Never use color='destructive' for an action that grants access or creates something.
  • Wrap Cancel in DialogClose asChild. Never wrap the confirm button in DialogClose: it closes the dialog before the request runs.
  • Never add a close button to DialogHeader. It renders the close X itself.
  • There is no onConfirm, onCancel, confirmLabel, destructive or loading prop on Dialog, no DialogAction/DialogCancel, and no initial-focus prop.

Spacing

  • The parts own all padding (header pt-20 pb-16 px-24, body px-24 py-8, footer px-24 py-16 gap-8). Keep the body's 8px though Figma draws the input flush.
  • Never add p-*, gap-* or space-y-* around dialog content, wrap footer buttons in a div/HStack, or pass size to them (default 36px).
  • Never pass className to DialogHeader, DialogBody or DialogFooter. They take only children and ref.

Behavior

  • While the request runs, pass loading={pending} to confirm (it also disables it; do not add disabled={pending}) and ignore close requests. Close only on success; on failure keep it open with an error toast.
  • If the dialog closes, reset the type-to-confirm input to ''. Match the entity name exactly, case-sensitive.
  • If the dialog opens from a Drawer, render it inside DrawerContent. See Layering.
  • To guard unsaved changes, intercept onOpenChange(false) on the Drawer. One handler covers the close X, Escape and outside click.
  • Never open a confirmation from a toast or from another confirmation.
  • Use one controlled open state per dialog, set by the control that starts the action.

Copy

PartWriteNot
Title"Delete user?" / bulk "Delete 3 users?""Are you sure?", "Warning", "Delete", "Delete selected?"
Title, unsaved changes"Unsaved changes""Discard changes?"
Description"This permanently deletes {name} and all their access. You can't undo this.""This action cannot be undone." with no object named
Description, bulk"This permanently deletes 3 users and all their access. You can't undo this."Naming only the first user
Description, reversible"{name} loses access until you reactivate them. Their roles and data are kept."Hiding what is kept
Confirm"Delete user" / bulk "Delete 3 users""OK", "Yes", "Confirm", "Delete", "Delete all"
Cancel"Cancel""No", "Close", "Back"
Footer, unsaved changes"Keep editing", "Leave without saving" (both ghost neutral), "Save changes" (brand)"Cancel"
Type-to-confirm placeholderEnter "{name}" to confirm"Type here"
Toast"User deleted" / "3 users deleted""Success!", "User was deleted successfully."
  • Title is <Verb> <object>? in sentence case. Confirm repeats that verb and noun without ?.
  • Name the specific object in the description, and end with what can be undone or what is kept. If nothing can be undone, write "You can't undo this."
  • If Figma's confirm label differs from the title ("Delete rule?" / "Delete permission"), use the title's noun.

Examples

A delete confirmation with pending, success and failure handling.

Opened from a row's actions menu, which sets the selected user and the dialog's own open state. While the request runs, Escape and outside clicks are ignored; on success the row is removed.

A state change that grants access uses the default brand confirm.

The description says what the user gets back. Once active, the same button deactivates: that dialog uses a destructive confirm and says the roles and data are kept.

Type-to-confirm omits width and keeps confirm disabled until the name matches.

For a delete that also breaks linked objects. The match is exact and case-sensitive, and closing the dialog resets the input to ''.

An unsaved-changes guard intercepts the drawer's close and renders the dialog inside DrawerContent.

While the form is dirty, the close X, Cancel, Escape and an outside click all open the same dialog. "Keep editing" returns to the form; "Leave without saving" drops the edits.

States

StateShowExample component
IdleQuestion, consequence, Cancel and confirm enabledDialog
Type-to-confirm, empty or wrongConfirm disabledButton disabled={value !== name}
Type-to-confirm, matchesConfirm enabledButton
PendingSpinner on confirm, dialog stays open, close ignoredButton loading={pending}
SuccessDialog closes, then a toasttoast.create({ type: 'default' })
FailureDialog stays open, error toast, confirm enabled againtoast.create({ type: 'error' })

What your app owns

  • The request, pending state, error handling and blocking close while pending.
  • Type-to-confirm matching and resetting the input on close.
  • Dirty tracking (your form library's flag) and intercepting the drawer close.
  • Route changes and tab close from a dirty form: use your router's blocker and beforeunload. The design system does not handle them.
  • Result toasts: useToast from @wallarm-org/design-system/Toast, with one Toaster at the app root.
  • All copy, including entity names.