TokenGlyph
Square glyphs for design tokens: overlapping colour swatches, an Aa type sample, or a spacing dimension line.
Aa
Install
npx shadcn@latest add @jbm/token-glyphNeeds the @jbm entry in components.json; see Install once.
Also installs @jbm/tokens, @jbm/paper.
Usage
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>API
- Stage px
- Declared at the documented defaults
- Landscape
150 by 150- Vertical
150 by 150- Basis
Square size × size box at the default size 150; the colour swatch shadows extend past it.
TokenGlyphcomponent
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). |
TokenKindtype
The glyph names: "color" | "type" | "space".
QA checks
- 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.