Feedback
Alert dialog
Asks to confirm an action that cannot be undone, before it runs.
Installation
pnpm add @elsikora/keystone-ui-kitUsage
import { AlertDialogContent, AlertDialog, AlertDialogAction } from "@elsikora/keystone-ui-kit";import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Button,} from "@elsikora/keystone-ui-kit";
export default function AlertDialogDefaultExample() { return ( <AlertDialog> <AlertDialogTrigger asChild> <Button variant="destructive">Retire the release</Button> </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Retire release 1.1.0?</AlertDialogTitle> <AlertDialogDescription>New rounds stop at once; open rounds finish.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Keep it</AlertDialogCancel> <AlertDialogAction variant="destructive">Retire</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> );}Examples
Default
API reference
AlertDialogContent
| Prop | Type | Default | Description |
|---|---|---|---|
container | Element | DocumentFragment | null | - | Where it opens; by default the nearest PortalRoot's element, else the body. |
AlertDialog
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | Open, when the caller holds the state. |
onOpenChange | (open: boolean) => void | - | Called when it opens or closes. |
AlertDialogAction
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "destructive" | "default" | The look of the confirming button. |
Notes
- The focus moves into the dialog and starts on Cancel; Escape cancels; the focus returns to the trigger.