Alert Dialog
A modal confirmation that requires an explicit user response before a destructive action.
Show codeHide code
Installation
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogBody,
AlertDialogHeader,
AlertDialogIcon,
AlertDialogIntro,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogActions,
AlertDialogCloseGroup,
AlertDialogClose,
} from "@makeplane/propel/components/alert-dialog";Usage
Compose a 600px card: AlertDialogBody stacks the intent badge (AlertDialogIcon) above the
title/description (AlertDialogIntro), optional fields go in the body under the header, and
AlertDialogActions is the bordered footer. Pin a corner dismiss with AlertDialogCloseGroup +
IconButton rendering AlertDialogClose.
import {
AlertDialog,
AlertDialogActions,
AlertDialogBody,
AlertDialogClose,
AlertDialogCloseGroup,
AlertDialogContent,
AlertDialogDescription,
AlertDialogHeader,
AlertDialogIcon,
AlertDialogIntro,
AlertDialogTitle,
AlertDialogTrigger,
} from "@makeplane/propel/components/alert-dialog";
import { Button } from "@makeplane/propel/components/button";
import { Icon } from "@makeplane/propel/components/icon";
import { IconButton } from "@makeplane/propel/components/icon-button";
import { X } from "lucide-react";
export default function BasicDemo() {
return (
<AlertDialog>
<Button
stretch="auto"
variant="danger"
size="md"
render={<AlertDialogTrigger />}
label="Delete project"
/>
<AlertDialogContent>
<AlertDialogBody>
<AlertDialogHeader>
<AlertDialogIcon variant="danger" />
<AlertDialogIntro>
<AlertDialogTitle>Delete project?</AlertDialogTitle>
<AlertDialogDescription>
This permanently removes the project and all of its work items. This action
can't be undone.
</AlertDialogDescription>
</AlertDialogIntro>
</AlertDialogHeader>
</AlertDialogBody>
<AlertDialogActions>
<Button
stretch="auto"
variant="secondary"
size="md"
render={<AlertDialogClose />}
label="Cancel"
/>
<Button
stretch="auto"
variant="danger"
size="md"
render={<AlertDialogClose />}
label="Delete"
/>
</AlertDialogActions>
<AlertDialogCloseGroup>
<IconButton
variant="ghost"
size="xs"
aria-label="Close"
render={<AlertDialogClose />}
icon={<Icon icon={X} />}
/>
</AlertDialogCloseGroup>
</AlertDialogContent>
</AlertDialog>
);
}Examples
Variants
The leading AlertDialogIcon badge sets the confirmation’s intent through its required variant
— danger, warning, info, or success. It defaults to a filled status glyph; pass children
to override. Use a danger primary action for destructive confirmations; other intents typically
use primary.
Show codeHide code
Open from menu
An alert dialog opened by a menu item is controlled through open / onOpenChange rather than an AlertDialogTrigger.
Show codeHide code
Multiple triggers
createAlertDialogHandle connects many detached triggers to one shared confirmation, each passing the project it acts on as its payload.
Show codeHide code
API Reference
AlertDialog
The alert dialog Root — Base UI's context/state provider (renders no element of its own). Always modal and non-dismissible, so it requires an explicit user response. A behavior-only role, so it lives in `components` (rules 1a, 2); the styled parts live in `elements/alert-dialog` and are grafted onto Base UI behavior here.
AlertDialogTrigger
The behavior that opens the alert dialog. Use as the `render` target of a `Button` so the styled primitive's look wins via render-composition: ```tsx <Button variant="danger" size="lg" label="Delete project" render={<AlertDialogTrigger />} />; ``` Base UI manages `aria-haspopup`/`aria-expanded` and focus restoration when the alert dialog closes. Maps 1:1 to `AlertDialog.Trigger`.
AlertDialogContent
Convenience that composes the alert dialog overlay boilerplate — Base UI portal, the shared `internal` backdrop, the centering viewport, and the centered popup — so a consumer only writes the trigger and the popup body.
AlertDialogBody
The padded content region of the alert dialog popup. Stacks the header (icon + intro) and any optional body content (form fields, extra copy) with a 16px gap. Caps height so tall content scrolls while the actions footer stays pinned. `tabIndex={0}` by default so a keyboard user can scroll a body with no other focusable content (WCAG 2.1.1).
AlertDialogHeader
Groups the leading `AlertDialogIcon` badge above the `AlertDialogIntro` (title + description). Lives inside `AlertDialogBody`. Pass icon and intro as children.
AlertDialogIcon
The leading intent badge above the title. Soft tinted surface + filled status glyph selected from `variant` — callers never pass an icon (matches `ToastStatusIcon`). Decorative (`aria-hidden`) — the title carries the accessible name. `variant` is required (`danger` | `warning` | `info` | `success`).
AlertDialogIntro
Groups the title and description with a 6px gap. Pass `AlertDialogTitle` and `AlertDialogDescription` as children.
AlertDialogTitle
The accessible title for the alert dialog. Base UI links it to the popup via `aria-labelledby`; the styled `elements` title supplies the h5/medium look.
AlertDialogDescription
The supporting description for the alert dialog. Base UI links it to the popup via `aria-describedby`; the styled `elements` description supplies the body-xs / tertiary look.
AlertDialogActions
The footer row of action buttons. Draws a top border, pads to match the body gutter, and right-aligns children with a 12px gap.
AlertDialogCloseGroup
Positions the corner dismiss control at the popup's top-end. Pass an `IconButton` (components tier) or the styled `AlertDialogClose` (elements showcase) as the child.
AlertDialogClose
The behavior that closes the alert dialog when activated. Use as the `render` target of a `Button` so the styled primitive's look wins via render-composition: ```tsx <Button variant="secondary" size="lg" label="Cancel" render={<AlertDialogClose />} />; ``` Maps 1:1 to `AlertDialog.Close`.