

<Preview name="AlertDestructiveExample" />

## Overview [#overview]

The **Alert** component displays important messages to users in a visually distinct way, supporting different severity levels with appropriate styling, iconography, and accessible markup to communicate the urgency and nature of the message effectively.

## Usage [#usage]

```tsx showLineNumbers
import { Alert, AlertDescription, AlertTitle } from "@tilt-legal/cubitt-components/primitives";
```

```tsx showLineNumbers
<Alert variant="default | destructive | info | warning | success">
  <Terminal />
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>
    You can add components and dependencies to your app using the cli.
  </AlertDescription>
</Alert>
```

## Examples [#examples]

### Default [#default]

<Tabs className="bg-transparent border-none rounded-none" items="['Preview', 'Code']">
  <Tab value="Preview" className="p-0">
    <Preview name="AlertDefaultExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { Alert, AlertDescription, AlertTitle } from "@tilt-legal/cubitt-components/primitives";

    import { AlertDescription, AlertTitle } from "@tilt-legal/cubitt-components/primitives";
    import {
      Terminal } from "@tilt-legal/cubitt-icons/ui/outline";

    <Alert>
      <Terminal />
      <AlertTitle>Heads up!</AlertTitle>
      <AlertDescription>
        You can add components and dependencies to your app using the CLI.
      </AlertDescription>
    </Alert>;
    ```
  </Tab>
</Tabs>

### Info [#info]

<Tabs
  className="bg-transparent border-none rounded-none"
  items="['Preview',
'Code']"
>
  <Tab value="Preview" className="p-0">
    <Preview name="AlertInfoExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { Alert } from "@tilt-legal/cubitt-components/primitives";

    import { AlertDescription, AlertTitle } from "@tilt-legal/cubitt-components/primitives";
    import {
      CircleInfo } from "@tilt-legal/cubitt-icons/ui/outline";

    <Alert variant="info">
      <CircleInfo />
      <AlertTitle>New features available</AlertTitle>
      <AlertDescription>
        We've added new components to the library. Check out the latest
        documentation for details.
      </AlertDescription>
    </Alert>;
    ```
  </Tab>
</Tabs>

### Destructive [#destructive]

<Tabs
  className="bg-transparent border-none rounded-none"
  items="['Preview',
'Code']"
>
  <Tab value="Preview" className="p-0">
    <Preview name="AlertDestructiveExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { Alert } from "@tilt-legal/cubitt-components/primitives";

    import { AlertDescription, AlertTitle } from "@tilt-legal/cubitt-components/primitives";
    import {
      CircleXmark } from "@tilt-legal/cubitt-icons/ui/outline";

    <Alert variant="destructive">
      <CircleXmark colorSecondary="currentColor" />
      <AlertTitle>Unable to process your payment</AlertTitle>
      <AlertDescription>
        Please verify your billing information and try again.
      </AlertDescription>
    </Alert>;
    ```
  </Tab>
</Tabs>

### Warning [#warning]

<Tabs
  className="bg-transparent border-none rounded-none"
  items="['Preview',
'Code']"
>
  <Tab value="Preview" className="p-0">
    <Preview name="AlertWarningExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { Alert } from "@tilt-legal/cubitt-components/primitives";

    import { AlertDescription, AlertTitle } from "@tilt-legal/cubitt-components/primitives";
    import {
      TriangleWarning } from "@tilt-legal/cubitt-icons/ui/outline";

    <Alert variant="warning">
      <TriangleWarning colorSecondary="currentColor" />
      <AlertTitle>Storage space running low</AlertTitle>
      <AlertDescription>
        You're using 85% of your available storage. Consider upgrading your plan or
        deleting unused files.
      </AlertDescription>
    </Alert>;
    ```
  </Tab>
</Tabs>

### Success [#success]

<Tabs
  className="bg-transparent border-none rounded-none"
  items="['Preview',
'Code']"
>
  <Tab value="Preview" className="p-0">
    <Preview name="AlertSuccessExample" />
  </Tab>

  <Tab value="Code">
    ```tsx
    import { Alert } from "@tilt-legal/cubitt-components/primitives";

    import { CircleCheck } from "@tilt-legal/cubitt-icons/ui/outline";

    <Alert variant="success">
      <CircleCheck colorSecondary="currentColor" />
      <AlertTitle>Successfully deployed</AlertTitle>
      <AlertDescription>
        Your application has been deployed to production. All systems are running
        normally.
      </AlertDescription>
    </Alert>;
    ```
  </Tab>
</Tabs>

## Props [#props]

### Alert [#alert]

| Prop        | Type                                                             | Default     | Description                                  |
| ----------- | ---------------------------------------------------------------- | ----------- | -------------------------------------------- |
| `variant`   | `"default" \| "destructive" \| "info" \| "warning" \| "success"` | `"default"` | The visual style variant of the alert        |
| `className` | `string`                                                         | -           | Additional CSS classes to apply to the alert |
| `children`  | `React.ReactNode`                                                | -           | The content to display inside the alert      |
| `...props`  | `React.ComponentProps<"div">`                                    | -           | All other standard div HTML attributes       |

### AlertTitle [#alerttitle]

| Prop        | Type                          | Default | Description                                  |
| ----------- | ----------------------------- | ------- | -------------------------------------------- |
| `className` | `string`                      | -       | Additional CSS classes to apply to the title |
| `children`  | `React.ReactNode`             | -       | The title text content                       |
| `...props`  | `React.ComponentProps<"div">` | -       | All other standard div HTML attributes       |

### AlertDescription [#alertdescription]

| Prop        | Type                          | Default | Description                                        |
| ----------- | ----------------------------- | ------- | -------------------------------------------------- |
| `className` | `string`                      | -       | Additional CSS classes to apply to the description |
| `children`  | `React.ReactNode`             | -       | The description text content                       |
| `...props`  | `React.ComponentProps<"div">` | -       | All other standard div HTML attributes             |

***

## Design Guidelines [#design-guidelines]

### Variant Usage [#variant-usage]

* **Default**: General informational messages, neutral tone
* **Info**: Helpful information, tips, or feature announcements
* **Warning**: Important information that requires attention but isn't critical
* **Destructive**: Error messages, failed operations, or critical issues
* **Success**: Confirmation messages, successful operations, or positive feedback
