Client component

Alert Dialog

A Modal with forced-choice semantics for delete confirmations, unsaved changes and destructive actions. The panel announces as an alertdialog, clicking the overlay does not dismiss it, and there is deliberately no corner X — the user resolves it through the Footer actions (Esc still cancels, per the ARIA pattern).

Import#

import { AlertDialog } from "astralis-ui";

Relationship to Modal#

The parts are Modal's parts — same context, same styling, same composition. Only the root differs, so everything on the Modal page (sizes, centering, controlled state) applies here unchanged.

Props#

Modal's props, with overlay dismissal off by default:

PropTypeDefaultDescription
open · defaultOpen · onOpenChangeboolean · boolean · (open: boolean) => void— · false · —Controlled / initial state, and the change callback.
size"sm" | "md" | "lg" | "xl" | "full""md"Panel width.
centeredbooleantrueCenters the panel vertically.
closeOnOverlayClickbooleanfalseOff by default, unlike Modal: the user has to choose an action.
closeOnEscbooleantrueEscape cancels, as the ARIA pattern expects.

Parts#

There is deliberately no AlertDialog.CloseButton: the dialog resolves through the actions in its Footer.

PropTypeDefaultDescription
AlertDialog.Trigger / AlertDialog.Closechildren: ReactElement—Wrap a single element, such as a Button, to open or to close the dialog.
AlertDialog.Contentdiv props—The portalled, focus-trapped panel.
AlertDialog.Header / Body / Footerchildren · className—Layout regions. The Footer holds the actions that resolve the dialog.
AlertDialog.Title / AlertDialog.Descriptionchildren · className—Wired to aria-labelledby and aria-describedby.

Keyboard#

KeyAction
EscCancel and close (opt out with closeOnEsc={false})
Tab / Shift+TabCycle focus between the actions; it can't leave the dialog
Enter / SpaceActivate the focused action

On open, focus moves to the first focusable element inside the panel; on close it returns to the trigger.