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

Package: `@kela-systems/ui-components` 4.1.0

```tsx
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "@kela-systems/ui-components";
```

Links (Kela sign-in needed): [Storybook](https://main--6af1efd9453270bb59a6c00c.chromatic.com/?path=/docs/components-alertdialog--docs), [Source](https://github.com/Kela-Systems/kela/tree/main/packages/next/ui-components/src/alert-dialog), [Figma](https://www.figma.com/design/anhlwrbFM6mUiL0klxeK1I/ARK---Design-System?node-id=22-307)

## Examples

### Confirm a destructive action

Name the action on the confirm button, and say what happens.

```tsx
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

A `className` on a part adds layout only: placement, sizing and spacing. Pick a look with a variant.

### AlertDialog

Also takes the props of `@base-ui/react/alert-dialog`.

### AlertDialogAction

| Variant | Values | Default |
| --- | --- | --- |
| `variant` | `default`, `secondary`, `destructive`, `outline`, `ghost`, `link` | `default` |
| `size` | `default`, `xs`, `sm`, `lg`, `icon`, `icon-xs`, `icon-sm`, `icon-lg` | `default` |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `loading` | `boolean` |  | Shows a spinner and prevents interaction while keeping the variant's resting colors. |

Also takes the props of `@base-ui/react/button`.

### AlertDialogCancel

| Variant | Values | Default |
| --- | --- | --- |
| `variant` | `default`, `secondary`, `destructive`, `outline`, `ghost`, `link` | `outline` |
| `size` | `default`, `xs`, `sm`, `lg`, `icon`, `icon-xs`, `icon-sm`, `icon-lg` | `default` |

Also takes the props of `@base-ui/react/alert-dialog`.

### AlertDialogContent

| Variant | Values | Default |
| --- | --- | --- |
| `size` | `default`, `sm` | `default` |

Also takes the props of `@base-ui/react/alert-dialog`.

### AlertDialogDescription

Also takes the props of `@base-ui/react/alert-dialog`.

### AlertDialogFooter

Also takes the attributes of the HTML element it renders.

### AlertDialogHeader

Also takes the attributes of the HTML element it renders.

### AlertDialogMedia

| Variant | Values | Default |
| --- | --- | --- |
| `variant` | `default`, `destructive` | `default` |

Also takes the attributes of the HTML element it renders.

### AlertDialogOverlay

Also takes the props of `@base-ui/react/alert-dialog`.

### AlertDialogPortal

Also takes the props of `@base-ui/react/alert-dialog`.

### AlertDialogTitle

Also takes the props of `@base-ui/react/alert-dialog`.

### AlertDialogTrigger

Also takes the props of `@base-ui/react/alert-dialog`.

## Related

- [Dialog](https://ark.kela.design/product/components/dialog.md)
