# Color Swatch Picker

> Grid of swatches for picking a named color.

Registry name: `color-swatch-picker`. HTML docs: https://ui.anuragroy.dev/component/color-swatch-picker.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/color-swatch-picker.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/color-swatch-picker.json`.

Registry JSON: https://ui.anuragroy.dev/r/color-swatch-picker.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/color-swatch-picker.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import {
  ColorSwatchPicker,
  ColorSwatchPickerItem
} from "@/components/ui/color-swatch-picker"
```

## Usage

```tsx
import {
  ColorSwatchPicker,
  ColorSwatchPickerItem,
} from "@/components/ui/color-swatch-picker"

export function Example() {
  return (
    <ColorSwatchPicker defaultValue="#3b82f6">
      <ColorSwatchPickerItem color="#3b82f6" />
      <ColorSwatchPickerItem color="#22c55e" />
      <ColorSwatchPickerItem color="#ef4444" />
    </ColorSwatchPicker>
  )
}
```

## API

### ColorSwatchPicker

React Aria ColorSwatchPicker.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | string \| Color | — |  |
| `defaultValue` | string \| Color | — |  |
| `onChange` | (color) => void | — |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/color-swatch-picker): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/color-swatch-picker.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
