Knit UI
GitHub

Playground

Loading playground…

true
Playground
<ColorSwatch
  color="#1971c2"
  size="md"
  withShadow
/>

Examples

Colors

Multiple color swatches side by side — the most common use-case.

Loading example…

ColorsSourceStorybook

Sizes

Full seven-step token size scale.

Loading example…

SizesSourceStorybook

Radii

Border radius from square (0) to fully rounded pill (9999).

Loading example…

RadiiSourceStorybook

Shadows

The inherited shadow elevation ladder, from xs to xl — distinct from the withShadow inset edge-ring; this drops a real elevation shadow under the swatch.

Loading example…

ShadowsSourceStorybook

No Shadow

Shadow overlay disabled — the inset ring that outlines the swatch is removed.

Loading example…

No ShadowSourceStorybook

With Children

Children rendered inside the swatch — useful for check marks or labels.

Loading example…

With ChildrenSourceStorybook

Palette Strip

A palette strip — large swatches at square radius to act as color cells.

Loading example…

Palette StripSourceStorybook

Styles

Per-slot styles targets individual parts — here the inset ring overlay.

Loading example…

StylesSourceStorybook

Props

PropTypeDefaultDescription
color requiredstring#1971c2Any valid CSS color string to display.
childrenReactNodeContent rendered inside the swatch.
disabled systemboolean | undefined
radius systemstring | number | undefined
0 · xs · sm · md · lg · xxl · 9999
9999 (pill)Border radius token or number; 9999 produces a pill/circle, 0 a square.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
size systemnumber | "xs" | "sm" | "md" | "lg" | "xl" | "xxs" | (string & {}) | "xxl" | undefined
xxs · xs · sm · md · lg · xl · xxl
"md"Width and height of the swatch. Standard keys resolve against the size scale; numbers and CSS strings are also supported.
styles systemSlotStyles<ColorSwatchStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.
theme systemThemeName | null | undefinedApplies a theme to this element
withShadowboolean | undefinedtrueAdds an inset shadow overlay to define the swatch edge.

Style slots

Every part of ColorSwatch can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
overlaystyles={{ overlay: { … } }}
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 497 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.