Skip to Content
Documentation
Getting startedComponentsChartsTheming
Get Pro
Overview
Concepts

Color Swatch

Used to preview a color

Recipe

Anatomy

import { ColorSwatch, ColorSwatchMix } from '@chakra-ui/react'
<ColorSwatch value="#bada55" />

Examples

Sizes

Use the size prop to change the size of the color swatch.

Alpha

The value prop accepts any valid CSS color, including colors with an alpha channel.

With Badge

Here's an example of how to compose the ColorSwatch with a Badge.

#bada55

Mixed Colors

Use the ColorSwatchMix to create a color swatch that contains multiple colors, but retains the size of a single color swatch.

Palette

Here's an example of composing multiple swatches to create a palette.

Props

PropDefaultType
colorPalette 'gray'
'base' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'sidebar' | 'sidebar.accent' | 'interaction' | 'accent' | 'presence' | 'status' | 'slate'

The color palette of the component

size 'md'
'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'inherit' | 'full'

The size of the component

shape 'rounded'
'square' | 'circle' | 'rounded'

The shape of the component