Color Picker

Composable color picker whose trigger chip morphs into the saturation and brightness area. A loupe lifts off each thumb while you drag. Includes hue and opacity sliders, hex, RGB and HSL fields, an eye dropper, presets, full keyboard control, and a controlled or uncontrolled value.

Preview

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/color-picker

API Reference

hsvaToRgba

h
number
—
s
number
—
v
number
—
a
number
—

formatHex

r
number
—
g
number
—
b
number
—
a
number
—

ColorPicker

value?
string

Controlled hex color (#rgb, #rrggbb or #rrggbbaa).

—
defaultValue?
string
#3478f6
onValueChange?
((value: string) => void)

Fires on every change while dragging or typing, with a lowercase hex.

—
onValueCommit?
((value: string) => void)

Fires once an interaction settles: pointer release, key, preset or field commit.

—
alpha?
boolean

Allow transparency. When false the value is always opaque. Default true.

true
name?
string

Submits the hex value with a form under this name.

—
open?
boolean

Controlled open state for ColorPickerTrigger + ColorPickerContent.

—
defaultOpen?
boolean
false
onOpenChange?
((open: boolean) => void)
—
className?
string
—

ColorPickerArea

label?
string

Accessible name for the 2D thumb. Default "Saturation and brightness".

Saturation and brightness
className?
string
—

ColorPickerHue

label?
string
Hue
className?
string
—

ColorPickerAlpha

label?
string
Opacity
className?
string
—

ColorPickerSwatch

className?
string
—

ColorPickerHexInput

className?
string
—

ColorPickerChannels

format?
"rgb" | "hsl"

Which channels to edit. Default "rgb".

rgb
className?
string
—

ColorPickerEyeDropper

className?
string
—

ColorPickerPresets

className?
string
—

ColorPickerPreset

value
string

Hex color this preset applies.

—
label?
string

Accessible color name. Defaults to the hex.

—
className?
string
—

ColorPickerTrigger

children?
ReactNode

Replaces the hex label beside the chip.

—
className?
string
—

ColorPickerContent

align?
"start" | "end"

Edge of the trigger the panel lines up with. Default "start".

start
className?
string
—

Updated