Basic palette

<ColorSwatch color="var(--dv-color-blue-filled)" />
<ColorSwatch color="var(--dv-color-violet-filled)" />
<ColorSwatch color="var(--dv-color-green-filled)" />

Sizes

<ColorSwatch color="#228be6" size="xs" />
<ColorSwatch color="#228be6" size="sm" />
<ColorSwatch color="#228be6" size="md" />
<ColorSwatch color="#228be6" size="lg" />
<ColorSwatch color="#228be6" size="xl" />

Radius variations

<ColorSwatch color="#7950f2" radius={0} />
<ColorSwatch color="#7950f2" radius="sm" />
<ColorSwatch color="#7950f2" radius="50%" />

With shadow and child content

<ColorSwatch color="#2f9e44" withShadow>
  <span style="color:white">✓</span>
</ColorSwatch>

Props

PropTypeDefaultDescription
colorstringCSS color value for the swatch fill (required)
size'xs'|'sm'|'md'|'lg'|'xl'|number|stringWidth and height of the swatch
radius'xs'|'sm'|'md'|'lg'|'xl'|stringBorder-radius of the swatch shape
withShadowbooleanAdds an inset box-shadow for contrast on light backgrounds
componentstring'div'HTML element to render as root
classstringAdditional CSS class names
styleobjectInline styles
childrenReactNodeOptional overlay content (e.g. checkmark)