# TokenGlyph (token-glyph)

> Square glyphs for design tokens: overlapping colour swatches, an Aa type sample, or a spacing dimension line.

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

## Install

```sh
npx shadcn@latest add @jbm/token-glyph
```

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/token-glyph.json, files[].content).

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

## API

### `TokenGlyph` (component)

One of three static illustrations in a size × size square: `color` draws an ink and a vermilion circle overlapping with the paper shadow; `type` draws a heavy Geist "Aa" with a vermilion a; `space` draws two ink blocks with a vermilion double-headed dimension arrow between them.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `kind` | `TokenKind` | required | Which token to illustrate: color, type, or space. |
| `size` | `number` | `150` | Side of the square in stage pixels; every shape and the type size (70% of it) scale with it. |
| `style` | `React.CSSProperties` | none | Inline styles on the outer element (a div for color and type, an svg for space). |

### `TokenKind` (type)

The glyph names: "color" | "type" | "space".

## Stage

Declared in stage pixels at the documented defaults.

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

Square size × size box at the default size 150; the colour swatch shadows extend past it.

## Examples

### All three tokens

```tsx
import { TokenGlyph, type TokenKind } from "@/jbm/ui/token-glyph"

const kinds: TokenKind[] = ["color", "type", "space"]
<div style={{ display: "flex", gap: 30 }}>
  {kinds.map((kind) => <TokenGlyph key={kind} kind={kind} size={150} />)}
</div>
```

## QA

- Render the three kinds side by side at one size: they share the square footprint and read at similar visual weight.
- Check the type glyph renders in Geist (font.sans) and does not overflow the square when fonts load late.
- Scale size down to about 60px: the spacing arrowheads and dimension line stay distinct.

## 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
