Colors

Color Swatch

A predefined color block that allows users to quickly select commonly used or brand-specific colors. It displays colors in various sizes for easy identification.

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.

Unlock the full power of
Intent UI Design

Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.

Learn more