Swatch
Atom
A color sample: a filled rounded block with the token's name and value beneath it, the anatomy a design-system color sheet repeats down a page. Swatch owns the whole lockup, so a sheet never sets a bare block next to a hand-built text column and drifts row to row.
Playground
Every control sets a real prop of SwatchProps. The JSX below updates as you go.
Web
iOS
Android
JSX · SwatchProps
Variants
6 examples from src/atoms/swatch/swatch.md, each rendered live from its own JSX.
Sizes
Anatomy
1
Chip
2
Name
3
Value
Dimmed parts appear only in some states or variants.
Props
32 props on SwatchProps, grouped as they are declared in source. Required props are marked *.
Accessibility and keyboard
Keyboard
Enter
Activates
Space
Activates
Tab
Moves focus on
Semantics
Roles
img
radio
States
checked
ARIA on web
aria-checked
aria-hidden
aria-label
Below the platform minimum, the touch area grows to 44 pt on iOS and 48 dp on Android without moving the layout.
Platform skins
The playground's props on each platform: same tree, native shapes, type and touch sizes.
Usage
Pass a live theme token as color and the sample follows the active scheme; a hairline edge keeps a white or near-black sample visible on the surface behind it. The chip is 48px at a 12px corner (32 small, 72 large, and 20 tiny, the disc of a token Chip), the name a 13px line and the value lines 11px mono in the subtle ink; the lockup also comes as a circle, inline (the label beside the block), or as a block (a full-width ramp bar). ring draws the edge as a 1px inset ring in the field border instead of the hairline, the token chip's swatch. selected marks the chosen sample with the selection ring, a 2px gap in the page color and then a 2px accent band, and adds "selected" to its accessible name. decorative hides a sample from assistive tech when text beside it already names it (a theme choice's disc before its label), so the name is read once.
A palette picker takes one of the kit's five accent palettes, violet, cyan, mint, rose or amber (ThemeProvider's precedence: cyan, mint, rose, amber, violet), with selected and onPress. It is a 16px disc of the palette's hue, the same in both schemes, and a radio named for its palette ("Violet"). The palette in force wears the selection ring, a 2px gap in the card color and then a 2px muted-foreground band; the others draw none. On the web a hovered disc grows to 1.25 times its size. A size boolean sizes the disc to that sample edge (small is a 32px disc, the size a form's hue choice takes). Put the pickers in a radiogroup so the set reads as one choice. A plain sample still uses color.
Tokens
Read from the playground render. Values follow the scheme and the ion hue.
--fd
--fm
--ft
--tx3