# Badge (badge)

> Round check or cross badge in accent, ink, or paper tones for fixed and broken states.

- Entry: component
- Category: UI Bits
- Preview capabilities: none (still preview)
- Runtime: React
- Needs Remotion: no
- QA page: https://jbm-ui.bns.studio/c/badge
- JSON: https://jbm-ui.bns.studio/catalog/badge.json
- Registry item: https://jbm-ui.bns.studio/r/badge.json (source code in files[].content)

## Install

```sh
npx shadcn@latest add @jbm/badge
```

Also installs @jbm/tokens, @jbm/paper (registry dependencies install automatically).

## Required setup

1. Add the `@jbm` registry to components.json (keep any entries already there):

   ```json
   {
     "registries": {
       "@jbm": "https://jbm-ui.bns.studio/r/{name}.json"
     }
   }
   ```

2. Map `@/*` to `./src/*` in tsconfig.json `compilerOptions.paths`, so `@/jbm/…` imports resolve to src/jbm/.

## Files

Each file's source code is in the registry item JSON (https://jbm-ui.bns.studio/r/badge.json, files[].content).

| Source path | Installs to | Import |
| --- | --- | --- |
| `registry/jbm/ui/badge.tsx` | `src/jbm/ui/badge.tsx` | `@/jbm/ui/badge` |

## API

### `Badge` (component)

Circle with the paper shadow and a stroked check or cross (55% of the size). Accent and ink fills draw a cream mark; paper draws an ink mark with a 2px ink outline. Static; animate it by wrapping or via style.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `kind` | `"check" \| "x"` | required | Mark to draw: check (fixed) or x (broken). |
| `size` | `number` | `44` | Diameter in stage pixels. |
| `tone` | `PaperTone` | `"accent"` | Fill: accent (vermilion, default), ink, or paper (cream with an ink outline). |
| `style` | `React.CSSProperties` | none | Inline styles merged last; use for absolute placement, opacity, or transforms. |

## Stage

Declared in stage pixels at the documented defaults.

| Orientation | Width | Height |
| --- | --- | --- |
| Landscape (1920×1080) | 44 | 44 |
| Vertical (1080×1920) | 44 | 44 |

Square size × size box at the default size 44; the shadow extends below it.

## Examples

### Fixed and broken

```tsx
import { Badge } from "@/jbm/ui/badge"

<div style={{ display: "flex", gap: 40 }}>
  <Badge kind="check" size={100} />
  <Badge kind="x" size={100} tone="ink" />
</div>
```

## QA

- Compare all three tones with both marks: the mark stays legible (cream on accent and ink, ink on paper).
- At small sizes the 4-unit stroke of the 24-unit icon scales down; check the check and cross remain readable around 24px.

## Family

Interface bits

## Related

Installs:

- [Tokens (tokens)](https://jbm-ui.bns.studio/catalog/tokens.md)
- [Paper (paper)](https://jbm-ui.bns.studio/catalog/paper.md)

Bundled in:

- [UiBits (ui-bits)](https://jbm-ui.bns.studio/catalog/ui-bits.md)

## More

- [llms.txt](https://jbm-ui.bns.studio/llms.txt): index of every item
- [catalog.json](https://jbm-ui.bns.studio/catalog.json): every item as JSON
- [Agent contract](https://jbm-ui.bns.studio/docs/agent-contract.md): what each field means
