Color Swatch

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/color-swatch

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components

Anatomy

import { ColorSwatch } from "@/components/ui/color-swatch"

<ColorSwatch aria-label="Current color" color="#0d6efd" />

Examples

Size

You can use the --color-swatch-size variable to adjust the size of the color swatch.

Component API

ColorSwatch

The ColorSwatch component displays a color preview.

PropTypeDefault
classNamestring-

See the React Aria for the full API reference.