Color Picker

Color picker with HEX, RGB, HSL, and OKLCH formats, alpha channel, optional swatches, and an eyedropper. Available as an inline panel or popover.

Installation

Default

#

Popover

With Swatches

#

OKLCH Format

Controlled

#

Current: #3b82f6

Removable Trigger

Eyedropper Support

The eyedropper uses the native window.EyeDropper API (Chromium-based browsers). It is automatically hidden in browsers that do not support it.

ColorPicker Props

PropTypeDefaultDescription
valuestringControlled color value (any of the supported formats).
defaultValuestring"#ff0000"Initial color when uncontrolled.
onValueChange(value, parsed) => voidFired on every change. Receives the formatted string and a parsed color object with all formats.
format"hex" | "rgb" | "hsl" | "oklch"Controlled format selection.
defaultFormat"hex" | "rgb" | "hsl" | "oklch""hex"Initial format when uncontrolled.
onFormatChange(format) => voidFired when the user switches format.
swatchesstring[]Optional preset swatches. When omitted, the strip is hidden.
hideEyedropperbooleanfalseForce-hide the eyedropper button (it is automatically hidden in unsupported browsers).

ColorPickerPopover Props

PropTypeDefaultDescription
triggerLabelstringOptional label rendered alongside the color tile.
triggerLabelPosition"left" | "right""left"Position of the label relative to the color tile.
triggerShowValuebooleantrueShow the hex value (without alpha) next to the tile.
triggerShowRemovebooleanfalseRender an X button on the trigger.
onTriggerRemove() => voidFired when the X button is clicked.
triggerClassNamestringCustom classes on the trigger button.
...ColorPickerPropsColorPickerPropsAll ColorPicker props are forwarded to the panel.