Color Picker
Saturation area, hue slider, hex input, swatches and the native eyedropper, in a popover or inline. No color library needed.
Inputs
In review
Playground
Tweak the props, the preview and the code follow.
Props
<ColorPicker defaultValue="#8b5cf6" />
Installation
npx @plumsydev/plum-ui add color-pickerAlso pulls in popover automatically.
Usage
import { ColorPicker } from "@/components/ui/color-picker"<ColorPicker defaultValue="#8b5cf6" />Examples
Inline panel
ColorPickerPanel renders without the popover.
#
Acme Pro
Your brand, applied live.
Theme editor
Primary
Accent
Surface
Inbox3 new
Design review at 3pm
Invoice #2041 paid
API Reference
ColorPicker
| Prop | Type | Default |
|---|---|---|
valueControlled hex color. | string | — |
defaultValueInitial color when uncontrolled. | string | "#8b5cf6" |
onValueChangeCalled while dragging and typing. | (hex: string) => void | — |
swatchesPreset colors. Pass `[]` to hide them. | string[] | — |
alignPopover alignment. | "start" | "center" | "end" | "start" |
childrenCustom trigger. | ReactNode | — |
ColorPickerPanel
| Prop | Type | Default |
|---|---|---|
value*Hex color. | string | — |
onValueChange*Change handler. | (hex: string) => void | — |
swatchesPreset colors. | string[] | — |
Notes
- Both sliders are keyboard accessible: arrows nudge by 1%, Shift by 10%.
- The eyedropper button only shows in browsers that support the
EyeDropperAPI.