Swatch
Low-level visual swatch primitive for colours, gradients, and images -
shaped as a **chip** (circle/pill) or a **tile** (square material/image
card). A thin façade dispatching on kind to the internal chip and tile
renderers, which share fill resolution and contrast handling.
Chips paint the darkening overlay on every fill and draw the double-ring
selection pattern; tiles use tiered radius, border, ring and shadow, children > src > color
precedence, and no darkening overlay.
Usage
Best practices
Feed fills through
color/background/colors, never a hex inclassName/style- the props drive the contrast-aware text colour, selection ring, and darkening overlay.Reach for
Swatchfor a selectable colour/gradient/material chip or tile; a tiny non-interactive status marker isDot, and a display-only status/category label isBadge.For a gradient or image chip fill pass
light- auto contrast detection (isLightColor) only reads solid colours, so overlaid icons/labels lose legibility without it.
Props
StackedSwatchFan
Swatch
SwatchFrameRing
Also exports
- interface
ChipSwatchProps - const
computeSwatchFanTransforms - const
getStackedSwatchFanFrame - const
getStackedSwatchFanTarget - interface
StackedSwatchFanItem - interface
StackedSwatchFanProps - type
SwatchColorStop - type
SwatchProps - interface
TileSwatchProps
Composition
Used by