Alert Dialog
Modal that interrupts the flow to confirm a destructive or irreversible action.
Installation
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "@xerobi/ui/alert-dialog"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Confirm a destructive action
import { Button } from "@xerobi/ui/button"
export function AlertDialogDestructive() {
return (
<AlertDialog>
<AlertDialogTrigger render={<Button variant="outline" color="error">Delete project</Button>} />
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete "Billing site"?</AlertDialogTitle>
<AlertDialogDescription>Its deployments and domains are removed. This cannot be undone.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Delete project</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}API reference
AlertDialog
Also accepts every prop of Base UI AlertDialog.
No props of its own.
AlertDialogAction
| Prop | Type | Description |
|---|---|---|
| variant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "soft" | |
| size | "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | |
| color | "info" | "success" | "warning" | "secondary" | "inherit" | "primary" | "error" | |
| loading | boolean | |
| disableRipple | boolean | Turns off the press ripple. |
AlertDialogCancel
| Prop | Type | Description |
|---|---|---|
| variant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "soft" | |
| size | "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" |
AlertDialogContent
| Prop | Type | Description |
|---|---|---|
| size | "default" | "sm" |
AlertDialogDescription
No props of its own.
AlertDialogFooter
Also accepts every prop of <div> element.
No props of its own.
AlertDialogHeader
Also accepts every prop of <div> element.
No props of its own.
AlertDialogMedia
Also accepts every prop of <div> element.
No props of its own.
AlertDialogOverlay
No props of its own.
AlertDialogPortal
No props of its own.
AlertDialogTitle
No props of its own.
AlertDialogTrigger
No props of its own.
Styling hooks: [data-slot="alert-dialog"], [data-slot="alert-dialog-trigger"], [data-slot="alert-dialog-portal"], [data-slot="alert-dialog-overlay"], [data-slot="alert-dialog-content"], [data-slot="alert-dialog-header"], [data-slot="alert-dialog-footer"], [data-slot="alert-dialog-media"], [data-slot="alert-dialog-title"], [data-slot="alert-dialog-description"], [data-slot="alert-dialog-action"], [data-slot="alert-dialog-cancel"].