# Badge

> A short, read-only label for state: Draft, Locked, Shared, Revised.

Source: https://kwark.space/designSystem/components/badge

## Usage

### What it is
A small pill that states a fact about the thing it sits on. The real ones are on the project library: the stage pill in the list (*● Drafting*), the tags beside a title (*Only on this device*, *Not synced yet*, *Shared by Thea Experience*), and the sharing badges (*Write*, *Read*, *Locked*).

### Variants
| Variant | Class | Where |
|---|---|---|
| Status | `kw-badge--status` + tone | The library list’s *Stage* column: a 6px dot and the stage |
| Accent tag | `kw-badge--accent` | *Only on this device*, *Shared with you* |
| Quiet tag | `kw-badge` | A franchise name, *Universe* |
| Tones | `--ok` `--info` `--warn` `--danger` | Sharing levels, sync states |

Each tone is the colour at 10% for the ground and 28% for the border, with the colour itself for the words.

### When not to use
- To rate anything. A badge never says *Strong*, *82%* or *Needs work* (Decision 0002).
- As a button. If it does something, it is a [Chip](https://kwark.space/designSystem/components/chip.md).

### Moving older code over
`Badge.tsx` still draws upper-case bold pills with Tailwind colours and a shadow. Use the library’s tag geometry above; the badge’s `color` prop maps green → ok, red → danger, yellow → warn, brand → accent, gray → quiet.

## Style

### Anatomy

1. **Pill**: 2px 8px (3px 8px for status), 999px corners, 1px border.
2. **Words**: Poppins 500, 12px, line height 1.2.
3. **Tone**: ground `color-mix(tone 10%)`, border `color-mix(tone 28%)`, words in the tone.
4. **Glyph or dot**: 14px glyph or a 6px dot, 4px gap (8px for status).

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-ok` | #2c6e49 | #6cc08a |
| `--k-ok-bg` | #e7f3ec | #17281e |
| `--k-info` | #255799 | #7db4f0 |
| `--k-info-bg` | #e8f0fa | #172334 |
| `--k-warn` | #8a5a00 | #d8a44a |
| `--k-warn-bg` | #f8efd9 | #2b2313 |
| `--k-danger` | #b4382c | #e0685c |
| `--k-danger-bg` | #fbe9e7 | #321b19 |
| `--k-radius-pill` | 999px |  |

## Code

### React

In the Kwark app: `import Badge from '@/components/ui/Badge'`.

```tsx
<Badge color="green">Locked</Badge>
```

| Prop | Type | Notes |
|---|---|---|
| `color` | `'brand' \| 'green' \| 'red' \| 'yellow' \| 'purple' \| 'gray'` | maps to ok, danger, warn |
| `size` | `'sm' \| 'md'` |  |

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<span class="kw-badge kw-badge--ok kw-badge--status"><i class="kw-badge__dot"></i>Drafting</span>
<span class="kw-badge kw-badge--accent"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m2 2 20 20M5.8 5.8A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.3-.2M21.5 15.5A4.5 4.5 0 0 0 17.5 10h-1.8A7 7 0 0 0 9.9 5.1"/></svg>Only on this device</span>
<span class="kw-badge">Universe</span>
<span class="kw-badge kw-badge--info"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7S2 12 2 12"/><circle cx="12" cy="12" r="3"/></svg>Read</span>
<span class="kw-badge kw-badge--warn">Not synced yet</span>
<span class="kw-badge kw-badge--danger">Changed elsewhere</span>
```

## Accessibility

- Text and background reach 4.5:1 in light, dark and every room.
- If the badge changes while someone is on the page (*Saved*), announce it with a polite live region.

## For agents

### Rules

- **Never** make a badge clickable.
- **Must** carry the meaning in the word, never in colour alone.
- **Never** use red for anything that does not block work; Kwark does not alarm people.

### AI readiness test

**Task:** Show the state of each call sheet in a list: draft, issued, revised after issue.

**Give the agent:** Badge, Content and voice.

**Constraint:** No new colours.

**A reliable answer:**
- Draft neutral, Issued ok, Revised info
- Words, not icons alone
- No red
