Overlays
Alert dialog
A question that stops the work until it is answered: a delete, a discard. Focus starts on the safe answer.
Overlays
A question that stops the work until it is answered: a delete, a discard. Focus starts on the safe answer.
Change the props on the right, then open the alert. variant is the action button's.
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from 'omuk-ui/alert-dialog';
import { Button } from 'omuk-ui/button';
<AlertDialog open={open} onOpenChange={setOpen}>
<AlertDialogTrigger render={<Button variant="outline" />}>
Open the alert
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete the project?</AlertDialogTitle>
<AlertDialogDescription>Its environments and secrets go too. You cannot undo this.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction variant="danger-confirm" onClick={() => setOpen(false)}>
Delete
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>The safe answer comes first and takes the focus. The action is a Button: while the work runs, it shows a spinner and keeps its size, and the parent closes the dialog when the work is done.
size: 'sm' is a narrow dialog whose two buttons share the width. AlertDialogMedia holds an icon above the title.