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-picker

Also 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

PropTypeDefault
value

Controlled hex color.

string—
defaultValue

Initial color when uncontrolled.

string"#8b5cf6"
onValueChange

Called while dragging and typing.

(hex: string) => void—
swatches

Preset colors. Pass `[]` to hide them.

string[]—
align

Popover alignment.

"start" | "center" | "end""start"
children

Custom trigger.

ReactNode—

ColorPickerPanel

PropTypeDefault
value*

Hex color.

string—
onValueChange*

Change handler.

(hex: string) => void—
swatches

Preset 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 EyeDropper API.