ColorPicker
Hex colour picking with a saturation area, hue and alpha sliders, presets and the EyeDropper API.
import { ColorPicker } from '@lobehub/ui/base-ui';Data Entry
Basic
Loading preview
APIs
ColorPicker properties
alphabooleanDefaults to
false.childrenReactElement<unknown, string | JSXElementConstructor<any>>classNamestringdefaultValuestringdisabledbooleanonChange(hex: string) => voidonChangeComplete(hex: string) => voidpresetsstring[]showTextbooleansize'small' | 'large' | 'middle'Defaults to
"middle".styleCSSPropertiesvaluestring
Values are lowercase hex strings; with alpha they are always 8 digits. onChange fires while dragging, onChangeComplete when the pointer is released or an input commits, so write to a store in onChangeComplete. Pass a single element as children to use your own trigger.
Migrating from antd ColorPicker
Colorobjects → hex strings;onChangeComplete={(c) => c.toHexString()}→onChangeComplete={(hex) => …}.disabledAlphais the default; setalphato enable it.presets={[{ label, colors }]}→presets={colors}.- RGB / HSL inputs, gradients and
formatare not supported.
Helpful?