Controls
<ColorSwatch />Installation
npm
pnpm
yarn
bun
npx shadcn@latest add @dotui/color-swatchUsage
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.
| Prop | Type | Default | |
|---|---|---|---|
Color | string | — | ||
string | — | ||
Last updated on 7/7/2026