Dark Mode
Colors
Drag And Drop
Forms
{"@context":"https://schema.org","@graph":[{"@type":"TechArticle","headline":"Color Picker","description":"A versatile UI component that provides multiple ways to choose colors, including sliders, swatches, and manual input, for comprehensive color selection.","url":"https://intentui.com/docs/components/colors/color-picker","author":{"@type":"Person","name":"Irsyad","url":"https://x.com/irsyad"},"publisher":{"@type":"Organization","name":"Intent UI","url":"https://intentui.com","logo":{"@type":"ImageObject","url":"https://intentui.com/icon.svg"}},"mainEntityOfPage":{"@type":"WebPage","@id":"https://intentui.com/docs/components/colors/color-picker"}},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://intentui.com"},{"@type":"ListItem","position":2,"name":"Docs","item":"https://intentui.com/docs"},{"@type":"ListItem","position":3,"name":"Components","item":"https://intentui.com/docs/components"},{"@type":"ListItem","position":4,"name":"Colors","item":"https://intentui.com/docs/components/colors"},{"@type":"ListItem","position":5,"name":"Color Picker","item":"https://intentui.com/docs/components/colors/color-picker"}]}]}
Color Picker
Loading...
Installation
Install the component via the CLI in one command.
npm
pnpm
yarn
bun
npx shadcn@latest add @intentui/color-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
pnpm
yarn
bun
npm install react-aria-components @heroicons/react tailwind-merge
Anatomy
import { ColorPicker } from "@/components/ui/color-picker";
import { Popover, PopoverBody, PopoverContent } from "@/components/ui/popover";
import { Button } from "@/components/ui/button";
import { ColorSwatch } from "@/components/ui/color-swatch";
import { ColorArea } from "@/components/ui/color-area";
import { ColorSlider, ColorSliderTrack } from "@/components/ui/color-slider";
import { ColorThumb } from "@/components/ui/color-thumb";
import { ColorField } from "@/components/ui/color-field";
import { Input } from "@/components/ui/input";<ColorPicker defaultValue="rgb(120,140,200)">
<Popover>
<Button intent="plain" data-slot="control">
<ColorSwatch />
Select color
</Button>
<PopoverContent className="[--gutter:--spacing(1)]">
<PopoverBody>
<div className="space-y-(--gutter)">
<ColorArea
colorSpace="rgb"
defaultValue="rgb(120,140,200)"
xChannel="red"
yChannel="green"
xName="red"
yName="green"
/>
<ColorSlider colorSpace="hsb" channel="hue">
<ColorSliderTrack>
<ColorThumb />
</ColorSliderTrack>
</ColorSlider>
<ColorField aria-label="Color">
<Input />
</ColorField>
</div>
</PopoverBody>
</PopoverContent>
</Popover>
</ColorPicker>Examples
Controlled
Control the selected color with the value prop to sync it with your application's state.
Loading...
Disabled
Disable the color picker by setting the isDisabled prop, making it non-interactive.
Loading...
Component API
ColorPicker
The ColorPicker component coordinates color input controls.
| Prop | Type | Default |
|---|---|---|
className | string | - |
EyeDropper
The EyeDropper component lets users pick a color from the screen when the browser supports it.
See the React Aria for the full API reference.
