Skip to content
Overlays & Tooltips

Confirmation Dialog

Ergonomic AlertDialog wrapper for destructive actions with async confirm.

Import

tsx
import { ConfirmationDialog } from "@cronus-ui/ui";
bash
npx cronus-ui add confirmation-dialog

Examples

.cronus

The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.

PortedParity: MatchGeometry 1/1Pixel diff 0 pxLogic 1/1Parity scoreboard
default.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component ConfirmationDialogDefault layout:inline style:confirmation-dialog {
  label "Delete project"
}

page "/audit/confirmation-dialog/default" type:custom {
  use ConfirmationDialogDefault
}

API Reference

Generated from the component's exported types.

ConfirmationDialogProps

Extends Omit<ComponentPropsWithoutRef<typeof AlertDialogContent>, "title" | "children">

Skip ConfirmationDialogProps props table
PropTypeDefaultDescription
trigger
ReactNode—Element that opens the dialog. Rendered inside an `AlertDialogTrigger asChild`, so a single focusable child (e.g. a `Button`) is expected. Omit when driving the dialog purely via `open`.
title*
ReactNode—Dialog heading — labels the dialog for assistive tech (rendered as `AlertDialogTitle`).
description
ReactNode—Supporting copy describing the consequence of the action (rendered as `AlertDialogDescription`).
confirmLabel
ReactNode"Confirm"Text for the confirm button.
cancelLabel
ReactNode"Cancel"Text for the cancel button.
destructive
booleanfalseStyle the confirm button as a destructive (red) action and default the header icon to a warning triangle.
icon
ReactNode—Icon shown in the header badge. Defaults to a warning triangle when `destructive`, otherwise none. Pass `null` to force it off.
onConfirm
() => void | Promise<void>—Invoked when the user confirms. If it returns a promise, the confirm button shows a spinner and is disabled until it settles; on resolve the dialog closes, on reject it stays open and surfaces the error message.
open
boolean—Controlled open state. Provide alongside `onOpenChange` to control the dialog externally.
defaultOpen
booleanfalseUncontrolled initial open state.
onOpenChange
(open: boolean) => void—Called whenever the open state changes (opening, cancelling, or confirming). Dismissal is suppressed while a confirm promise is pending.
asChild
boolean—Render as the child element via Slot.
className
string—Additional class names merged onto the root.