Color Swatch

A color swatch displays a color sample.

<ColorSwatch />

Installation

npx shadcn@latest add @dotui/color-swatch

Usage

Use color swatches to display a color sample.

import { ColorSwatch } from '@/components/ui/color-swatch'
<ColorSwatch color="#ff0000" />

Value

The color prop accepts a hex or CSS color string, or a Color object from parseColor. Translucent colors render over a checkerboard so their transparency shows through.

import { parseColor } from 'react-aria-components'
;<ColorSwatch color={parseColor('#7f0000aa')} />

Examples

Default

Color Palette

Sky
Emerald
Amber
Rose
Violet
Slate

In Button

API Reference

ColorSwatch

A ColorSwatch displays a preview of a selected color.

PropType
Color | string
string

Last updated on 7/7/2026