AlertDialog
Interrupts the current task to confirm a consequential action. Use it when proceeding could cause data loss or another result that is difficult to reverse.
React
Figma
React examples
Confirm a destructive action
Name the action on the confirm button, and say what happens.
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Button, } from "@kela-systems/ui-components"; export default function AlertDialogDefault() { return ( <AlertDialog> <AlertDialogTrigger render={<Button variant="destructive" />}> Abort mission </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Abort mission 12?</AlertDialogTitle> <AlertDialogDescription> Hawk 2 stops its route and returns to the dock. This can't be undone. </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Keep flying</AlertDialogCancel> <AlertDialogAction variant="destructive">Abort mission</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> ); }
Props
AlertDialog
No props of its own. It also takes the props of Base UI's alert-dialog.
AlertDialogAction
| Name | Default | Description |
|---|---|---|
variant"default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | "default" | |
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "default" | |
loadingboolean | Shows a spinner and prevents interaction while keeping the variant's resting colors. |
It also takes the props of Base UI's button.
AlertDialogCancel
| Name | Default | Description |
|---|---|---|
variant"default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | "outline" | |
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "default" |
It also takes the props of Base UI's alert-dialog.
AlertDialogContent
| Name | Default | Description |
|---|---|---|
size"default" | "sm" | "default" |
It also takes the props of Base UI's alert-dialog.
AlertDialogDescription
No props of its own. It also takes the props of Base UI's alert-dialog.
AlertDialogFooter
No props of its own. It also takes the attributes of the HTML element it renders.
AlertDialogHeader
No props of its own. It also takes the attributes of the HTML element it renders.
AlertDialogMedia
| Name | Default | Description |
|---|---|---|
variant"default" | "destructive" | "default" |
It also takes the attributes of the HTML element it renders.
AlertDialogOverlay
No props of its own. It also takes the props of Base UI's alert-dialog.
AlertDialogPortal
No props of its own. It also takes the props of Base UI's alert-dialog.
AlertDialogTitle
No props of its own. It also takes the props of Base UI's alert-dialog.
AlertDialogTrigger
No props of its own. It also takes the props of Base UI's alert-dialog.
Related
Weigh AlertDialog against these before you choose.