# Alert Dialog

A modal dialog that interrupts the user with important content and expects a response.

Section: Components / Overlays
Page: https://ui.heyramzi.com/components/alert-dialog
Import path: `@heyramzi/ui/shadcn/alert-dialog`

## Import

```ts
import * as AlertDialog from "@heyramzi/ui/shadcn/alert-dialog";
import { buttonVariants } from "@heyramzi/ui/shadcn/button";
```

## Usage

```svelte
<AlertDialog.Root>
  <AlertDialog.Trigger>Delete project</AlertDialog.Trigger>
  <AlertDialog.Content>
    <AlertDialog.Header>
      <AlertDialog.Title>Are you absolutely sure?</AlertDialog.Title>
      <AlertDialog.Description>This action cannot be undone.</AlertDialog.Description>
    </AlertDialog.Header>
    <AlertDialog.Footer>
      <AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
      <AlertDialog.Action>Continue</AlertDialog.Action>
    </AlertDialog.Footer>
  </AlertDialog.Content>
</AlertDialog.Root>
```

## Demo

```svelte
<script lang="ts">
	import * as AlertDialog from "@heyramzi/ui/shadcn/alert-dialog";
	import { buttonVariants } from "@heyramzi/ui/shadcn/button";
</script>

<AlertDialog.Root>
	<AlertDialog.Trigger class={buttonVariants({ variant: "outline" })}>
		Show Dialog
	</AlertDialog.Trigger>
	<AlertDialog.Content>
		<AlertDialog.Header>
			<AlertDialog.Title>Are you absolutely sure?</AlertDialog.Title>
			<AlertDialog.Description>
				This action cannot be undone. This will permanently delete your account and remove your data
				from our servers.
			</AlertDialog.Description>
		</AlertDialog.Header>
		<AlertDialog.Footer>
			<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
			<AlertDialog.Action>Continue</AlertDialog.Action>
		</AlertDialog.Footer>
	</AlertDialog.Content>
</AlertDialog.Root>
```

## API

### AlertDialog.Root

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `open` | `boolean` | `false` | bindable |

Every prop of `AlertDialog.Root` from `bits-ui`.

### AlertDialog.Trigger

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |

Every prop of `AlertDialog.Trigger` from `bits-ui`.

### AlertDialog.Content

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `portalProps` | `WithoutChildrenOrChild<ComponentProps<typeof AlertDialogPortal>>` |  |  |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `AlertDialog.Content` from `bits-ui`, except `child`.

### AlertDialog.Header

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### AlertDialog.Title

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `AlertDialog.Title` from `bits-ui`.

### AlertDialog.Description

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `AlertDialog.Description` from `bits-ui`.

### AlertDialog.Footer

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `band` | `boolean` | `false` | A hairline and a quiet surface out to both edges and the bottom corners. Last child only. |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### AlertDialog.Cancel

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `AlertDialog.Cancel` from `bits-ui`.

### AlertDialog.Action

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `AlertDialog.Action` from `bits-ui`.

### AlertDialog.Portal

Every prop of `AlertDialog.Portal` from `bits-ui`.

### AlertDialog.Overlay

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `AlertDialog.Overlay` from `bits-ui`.
