# Alert

Displays a callout for user attention.

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

## Import

```ts
import * as Alert from "@heyramzi/ui/shadcn/alert";
```

## Usage

```svelte
<Alert.Root>
  <Alert.Title>Your changes have been saved</Alert.Title>
  <Alert.Description>This is an alert with a title and a description.</Alert.Description>
</Alert.Root>
<Alert.Root variant="destructive">
  <Alert.Title>Unable to process your payment.</Alert.Title>
</Alert.Root>
```

## Demo

```svelte
<script lang="ts">
	import { CheckCircle, Popcorn, WarningCircle } from "phosphor-svelte";
	import * as Alert from "@heyramzi/ui/shadcn/alert";
</script>

<div class="grid w-full max-w-xl items-start gap-4">
	<Alert.Root>
		<CheckCircle aria-hidden="true" />
		<Alert.Title>Success! Your changes have been saved</Alert.Title>
		<Alert.Description>This is an alert with icon, title and description.</Alert.Description>
	</Alert.Root>
	<Alert.Root>
		<Popcorn aria-hidden="true" />
		<Alert.Title>This Alert has a title and an icon. No description.</Alert.Title>
	</Alert.Root>
	<Alert.Root variant="destructive">
		<WarningCircle aria-hidden="true" />
		<Alert.Title>Unable to process your payment.</Alert.Title>
		<Alert.Description>
			<p>Please verify your billing information and try again.</p>
			<ul class="list-inside list-disc text-sm">
				<li>Check your card details</li>
				<li>Ensure sufficient funds</li>
				<li>Verify billing address</li>
			</ul>
		</Alert.Description>
	</Alert.Root>
</div>
```

## API

### Alert.Root

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `variant` | `"default"` \| `"destructive"` | `"default"` |  |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `role` | `string` | `"alert"` |  |
| `children` | `Snippet` |  |  |

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

### Alert.Title

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

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

### Alert.Description

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

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