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) => voidNone · false · NoneControlled / 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: ReactElementNoneWrap a single element, such as a Button, to open or to close the dialog.
AlertDialog.Contentdiv propsNoneThe portalled, focus-trapped panel.
AlertDialog.Header / Body / Footerchildren · classNameNoneLayout regions. The Footer holds the actions that resolve the dialog.
AlertDialog.Title / AlertDialog.Descriptionchildren · classNameNoneWired 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.