Color Swatch Picker
A grid-based selection tool that presents a set of predefined colors for easy and consistent color choices, allowing for controlled selection and disabled states.
Installation
Install the component via the CLI in one command.
npx shadcn@latest add @intentui/color-swatch-picker
Composed components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
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 {
ColorSwatchPicker,
ColorSwatchPickerItem,
} from "@/components/ui/color-swatch-picker"<ColorSwatchPicker aria-label="Pick color">
<ColorSwatchPickerItem color="#f59e0b" />
<ColorSwatchPickerItem color="#84cc16" />
<ColorSwatchPickerItem color="#0d6efd" />
</ColorSwatchPicker>Examples
Controlled
The color swatch can be managed in a controlled manner.
Disabled
While you can disable individual picker items, disabling the entire picker is possible but generally not recommended.
Component API
ColorSwatchPicker
The ColorSwatchPicker component groups selectable color swatches.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ColorSwatchPickerItem
The ColorSwatchPickerItem component represents one selectable swatch.
| Prop | Type | Default |
|---|---|---|
className | string | - |
See the React Aria for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.