# Color input

> Typable field that reads hex, rgb(), hsl(), oklch() or a CSS name, with a swatch that opens the picker.

A shadcn/ui block from the [@reui](https://reui.io) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/reui/c-color-picker-3).

- Page, with a live preview: https://shadcn.exchange/r/reui/c-color-picker-3
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-color-picker-3-light-ca3cc2f96994ef0f.png
- Registry item: https://reui.io/r/new-york-v4/c-color-picker-3.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://reui.io/r/new-york-v4/c-color-picker-3.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@reui/color-picker`, `field`

## Files

### `c-color-picker-3.tsx`

```tsx
import {
  ColorPicker,
  ColorPickerContent,
  ColorPickerInput,
} from "@/components/reui/color-picker"

import {
  Field,
  FieldDescription,
  FieldLabel,
} from "@/components/ui/field"

export function Pattern() {
  return (
    <div className="w-full max-w-xs">
      <Field>
        <FieldLabel htmlFor="canvas-background">Canvas background</FieldLabel>
        {/* The input reads any CSS color on blur or Enter and writes it back
            as hex; the swatch button opens the full picker. */}
        <ColorPicker id="canvas-background" defaultValue="#f8fafc">
          <ColorPickerInput aria-describedby="canvas-background-description" />
          <ColorPickerContent />
        </ColorPicker>
        <FieldDescription id="canvas-background-description">
          Type a hex code, rgb(), hsl(), oklch() or a name like tomato.
        </FieldDescription>
      </Field>
    </div>
  )
}
```
