Component reference
AlertDialog
An explicit decision before deleting a resource.
Preview
Live previewOptional six-digit hex. Clear to restore the preset. Check contrast with your brand color.
Changes apply to this preview only.
Width adapts to the available space
"use client";
import {
AlertDialog,
AlertDialogTrigger,
Button,
AlertDialogContent,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogCancel,
AlertDialogAction
} from "@pimolu/react";
export function DemoExample() {
return (
<AlertDialog>
<AlertDialogTrigger>
<Button variant="danger" appearance="soft">Delete workspace</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete workspace?</AlertDialogTitle>
<AlertDialogDescription>
Every project, deployment and token in this workspace will be
removed. This cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>
<Button appearance="outline">Cancel</Button>
</AlertDialogCancel>
<AlertDialogAction>
<Button variant="danger">Delete permanently</Button>
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}More examples
Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.
Archive with a reported result
Explicit confirmation changes local application state and returns focus to its trigger.
Non-destructive confirmation
The same structure for an action that is important but reversible.
Content
Any content can sit between the header and the footer.
Usage
Reserve interruptive confirmation for consequential actions and use precise button labels.
API reference
Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.
PimoluAlertDialogProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | — | Trigger, content, header, footer and close controls. |
open | boolean | undefined | — | Controlled open state. Omit to let the component own it. |
defaultOpen | boolean | undefined | false | Initial open state when uncontrolled. Defaults to false. |
onOpenChange | ((open: boolean) => void) | undefined | — | Called whenever the component asks to open or close. |
childrenRequiredReactNodeNo default extracted.
Trigger, content, header, footer and close controls.
openboolean | undefinedNo default extracted.
Controlled open state. Omit to let the component own it.
defaultOpenboolean | undefinedDefault: false
Initial open state when uncontrolled. Defaults to false.
onOpenChange((open: boolean) => void) | undefinedNo default extracted.
Called whenever the component asks to open or close.
PimoluAlertDialogContentProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
className | string | undefined | — | Class applied to the panel. |
aria-describedby | string | undefined | — | Overrides the id registered by `DialogDescription`. |
aria-label | string | undefined | — | Accessible name of the dialog. Use it only when there is no `DialogTitle`; a title automatically names the dialog. |
aria-labelledby | string | undefined | — | Overrides the id registered by `DialogTitle`. |
children | ReactNode | — | Header, body and footer of the dialog. |
size | "sm" | "md" | "lg" | undefined | "md" | Maximum width of the panel. Defaults to "md". |
closeOnOverlayClick | boolean | undefined | true | Close when the overlay is pressed. Defaults to true. |
closeOnEscape | boolean | undefined | true | Close on Escape. Defaults to true. |
showCloseButton | boolean | undefined | true | Render the close button in the top corner. Defaults to true. |
closeLabel | string | undefined | "Close" | Accessible name of the corner close button. Defaults to "Close". |
classNamestring | undefinedNo default extracted.
Class applied to the panel.
aria-describedbystring | undefinedNo default extracted.
Overrides the id registered by `DialogDescription`.
aria-labelstring | undefinedNo default extracted.
Accessible name of the dialog. Use it only when there is no `DialogTitle`; a title automatically names the dialog.
aria-labelledbystring | undefinedNo default extracted.
Overrides the id registered by `DialogTitle`.
childrenReactNodeNo default extracted.
Header, body and footer of the dialog.
size"sm" | "md" | "lg" | undefinedDefault: "md"
Maximum width of the panel. Defaults to "md".
closeOnOverlayClickboolean | undefinedDefault: true
Close when the overlay is pressed. Defaults to true.
closeOnEscapeboolean | undefinedDefault: true
Close on Escape. Defaults to true.
showCloseButtonboolean | undefinedDefault: true
Render the close button in the top corner. Defaults to true.
closeLabelstring | undefinedDefault: "Close"
Accessible name of the corner close button. Defaults to "Close".
PimoluAlertDialogActionProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactElement<unknown, string | JSXElementConstructor<any>> | — | Usually a Button; it closes the dialog when activated. |
childrenRequiredReactElement<unknown, string | JSXElementConstructor<any>>No default extracted.
Usually a Button; it closes the dialog when activated.
Accessibility
- Check the named alert dialog, safe initial focus, Escape and restoration to the trigger.