# Color Picker

Color picker with palette, hex, and RGB input



<ComponentPreview base="ink" name="color-picker-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/color-picker
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="ink" name="color-picker" title="components/ui/color-picker.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { ColorPicker } from "@/components/ui/color-picker";
```

```tsx
<ColorPicker label="Pick a color" onChange={(color) => {}} />
```

API Reference [#api-reference]

ColorPicker [#colorpicker]

| Prop        | Type                      | Default           |
| ----------- | ------------------------- | ----------------- |
| `value`     | `string`                  | -                 |
| `onChange`  | `(color: string) => void` | -                 |
| `onSubmit`  | `(color: string) => void` | -                 |
| `label`     | `string`                  | -                 |
| `palette`   | `string[]`                | `DEFAULT_PALETTE` |
| `autoFocus` | `boolean`                 | `false`           |
| `id`        | `string`                  | -                 |
