# Alert

Alert box with info, success, warning, and error variants.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any docs URL. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

## Installation

```bash
npx shadcn@latest add @angular-pdfcn/takumi/alert
```

To install manually, add the dependencies:

```bash
npm install takumi-pdf @takumi-rs/helpers
```

Then copy these files into your project and update the import paths to match your setup:

- `components/pdf/alert/alert.ts`
- `lib/resolve-color.ts`
- `components/pdf/theme-provider.ts`
- `lib/pdf-renderer.ts`
- `lib/pdf-primitives.ts`
- `lib/render.ts`
- `lib/pdf-themes/professional.ts`
- `lib/pdf-themes/primitives.ts`
- `types/pdf-themes.ts`
- `types/pdf-components.ts`

## Usage

```ts
import { Component } from "@angular/core";

import { PdfAlert } from "@/components/pdf/alert/alert";
import { PdfHeading } from "@/components/pdf/heading/heading";
import { PdfSection } from "@/components/pdf/section/section";
import { PdfText } from "@/components/pdf/text/text";
import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
import {
  TakumiDocument,
  TakumiPage,
} from "@/lib/pdf-primitives";

@Component({
  imports: [
    TakumiDocument,
    TakumiPage,
    PdfcnThemeProvider,
    PdfAlert,
    PdfHeading,
    PdfSection,
    PdfText,
  ],
  template: `
    <takumi-document>
      <takumi-page size="A4">
        <pdf-theme-provider>
          <pdf-section spacing="none">
            <pdf-heading [level]="1">Document Alerts</pdf-heading>
            <pdf-text
              >The PdfAlert component displays callout boxes with different
              severity levels.</pdf-text
            >
            <pdf-section>
              <pdf-alert variant="info" title="Information"
                >This document contains important information about your
                account.</pdf-alert
              >
              <pdf-alert variant="success" title="Success"
                >Your payment has been processed successfully.</pdf-alert
              >
              <pdf-alert variant="warning" title="Warning"
                >Please review the terms and conditions before
                proceeding.</pdf-alert
              >
              <pdf-alert variant="error" title="Error"
                >Missing required fields. Please complete all
                sections.</pdf-alert
              >
            </pdf-section>
          </pdf-section>
        </pdf-theme-provider>
      </takumi-page>
    </takumi-document>
  `,
})
export class AlertDemo {}
```

## API Reference

### PdfAlert

| Input        | Type                                          | Default  |
| ------------ | --------------------------------------------- | -------- |
| `variant`    | `'info' \| 'success' \| 'warning' \| 'error'` | `'info'` |
| `title`      | `string`                                      | -        |
| `showIcon`   | `boolean`                                     | `true`   |
| `showBorder` | `boolean`                                     | `true`   |

The alert body is projected content.