Confirmation Dialog
Ergonomic AlertDialog wrapper for destructive actions with async confirm.
Import
import { ConfirmationDialog } from "@cronus-ui/ui";
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.
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">
| Prop | Type | Default | Description |
|---|---|---|---|
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 | boolean | false | Style 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 | boolean | false | Uncontrolled 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. |