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

Ready

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&apos;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

NameDefaultDescription
variant
"default" | "secondary" | "destructive" | "outline" | "ghost" | "link"
"default"
size
"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg"
"default"
loading
boolean
Shows a spinner and prevents interaction while keeping the variant's resting colors.

It also takes the props of Base UI's button.

AlertDialogCancel

NameDefaultDescription
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

NameDefaultDescription
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

NameDefaultDescription
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.

Weigh AlertDialog against these before you choose.

Read this page as Markdown

Search ARK

Find a page, a primitive or a component.