# Chip

> A filter or a choice you can switch on and off. Not a status and not a button.

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

## Usage

### When to use
To narrow a list by a few known values: *Day / Night*, a character, a location. A selected chip is lit, not filled: its border takes the project’s light accent and its ground steps up (Home’s filters, the date editor’s *Kind* and *Who it is for*).

### When not to
- More than about six values: use a [Select](https://kwark.space/designSystem/components/select.md) or a search field.
- On a phone above the fold: move filters into a [Sheet](https://kwark.space/designSystem/components/sheet.md) and show one active-filter line instead of a row of pills.
- To show state (*Draft*, *Locked*): that is a [Badge](https://kwark.space/designSystem/components/badge.md).

## Style

### Anatomy

1. **Pill**: 32px (44 under a thumb), 1px `--k-line`, 999px corners, no fill (`.k-chip`).
2. **Word**: Poppins 500, 12px, `--k-text-2`; 0 12px padding on the inner button.
3. **Selected**: border `--k-accent-soft`, ground `--k-raise`, text `--k-text`. It is lit, not filled.
4. **Remove ×**: a separate 32px button (44 on a phone) named *Remove filter Act 2*.
5. **Add**: dashed border, 12px 400, 4px 8px padding (Project home’s *Add a name* under Directors and Writers).

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-line` | #e2e8f0 | rgba(255, 255, 255, .1) |
| `--k-surface` | #ffffff | #1a1a1a |
| `--k-text` | #0f172a | #e3e3e3 |
| `--k-bg` | #f8fafc | #191919 |
| `--k-radius-pill` | 999px |  |
| `--k-fs-meta` | 12px |  |

## Code

### React

In the Kwark app: `import { Chip } from '@/components/ui/Chip'`.

```tsx
<Chip selected={on} onClick={toggle} onRemove={clear} removeLabel="Remove filter Act 2">Act 2</Chip>
```

| Prop | Type | Notes |
|---|---|---|
| `selected` | `boolean` |  |
| `onClick` | `() => void` | makes it a toggle (aria-pressed) |
| `onRemove` | `() => void` | adds the × |
| `removeLabel` | `string` | name of the × |

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<span class="kw-chip is-selected"><button type="button" aria-pressed="true">Drafting</button></span>
<span class="kw-chip"><button type="button" aria-pressed="false">Feature film</button></span>
<span class="kw-chip is-selected"><button type="button">Act 2</button><button type="button" class="kw-chip__x" aria-label="Remove filter Act 2"><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="M18 6 6 18M6 6l12 12"/></svg></button></span>
<button class="kw-chip kw-chip--add" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> Add a name</button>
```

## Accessibility

- Each chip is a toggle button with `aria-pressed`.
- Group them with a visible label or `role="group"` and `aria-label` (*Filter by time of day*).

## For agents

### Rules

- **Must** use `aria-pressed` on filter chips.
- **Never** use a chip for status; use Badge.
- **Never** put a row of chips above the fold on a phone; use a Sheet.

### AI readiness test

**Task:** Add time-of-day filtering to the scene list on desktop and phone.

**Give the agent:** Chip, Sheet, Phones pattern, Search and filter pattern.

**Constraint:** Phone content must start by y≈200.

**A reliable answer:**
- Chips on desktop
- On phone a Filter text button opening a Sheet
- One active-filter line when a filter is on
