# Badge

Compact status badge for labels and tags.

> 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/forme/badge
```

To install manually, add the dependencies:

```bash
npm install @formepdf/core @formepdf/shared
```

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

- `components/pdf/badge/badge.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 { PdfBadge } from "@/components/pdf/badge/badge";
import {
  FormeDocument,
  FormePage,
  FormeView,
} from "@/lib/pdf-primitives";

@Component({
  imports: [FormeDocument, FormePage, PdfBadge, FormeView],
  template: `
    <forme-document>
      <forme-page [size]="{ height: 200, width: 595 }" [margin]="40">
        <forme-view
          [style]="{
            display: 'flex',
            flexDirection: 'row',
            flexWrap: 'wrap',
            gap: 6,
            marginBottom: 12,
          }"
        >
          <pdf-badge label="Small" variant="default" size="sm" />
          <pdf-badge label="Medium" variant="default" size="md" />
          <pdf-badge label="Large" variant="default" size="lg" />
        </forme-view>
      </forme-page>
    </forme-document>
  `,
})
export class BadgeDemo {}
```

## API Reference

### PdfBadge

| Input        | Type                                                                                       | Default     |
| ------------ | ------------------------------------------------------------------------------------------ | ----------- |
| `label`      | `string`                                                                                   | -           |
| `variant`    | `'default' \| 'primary' \| 'success' \| 'warning' \| 'destructive' \| 'info' \| 'outline'` | `'default'` |
| `size`       | `'sm' \| 'md' \| 'lg'`                                                                     | `'md'`      |
| `background` | `string`                                                                                   | -           |
| `color`      | `string`                                                                                   | -           |

The badge text is the `label` input or projected content.