Skip to content

Color Picker

An enterprise-level color picker component that supports multiple formats, opacity adjustment, and seamless integration with BrFormItem.

Basic Usage

Provides basic color selection capabilities.

Example

Preset Colors

You can provide an array of commonly used preset colors for quick selection.

Example

Format & Opacity

Supports opacity adjustment and switching between multiple formats such as hex, rgba, hsla, etc.

Example

Inline Mode

In addition to the default popover mode, it also supports displaying the color picker panel directly inline.

Example

Form Integration

Seamlessly integrates with BrFormItem, supporting color value binding and validation state synchronization.

Example

Theming

Combined with BrConfigProvider, you can easily achieve global and local theme style customization.

Example

API

Props

NameTypeDefaultDescription
modelValuestringundefinedThe bound color value
defaultValuestringundefinedThe default color value
mode'popover' | 'inline''popover'The display mode
format'hex' | 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hsv''hex'The color format
showAlphabooleanfalseWhether to show the opacity adjustment slider
presetsstring[]undefinedAn array of preset colors
presetColsnumber8The number of columns for the preset color panel
presetGapnumber | string8The gap between preset colors
disabledbooleanfalseWhether the color picker is disabled
readonlybooleanfalseWhether the color picker is readonly
validationState'success' | 'warning' | 'error' | 'default''default'Validation state (automatically synchronized with form)
clearablebooleanfalseWhether to show the clear button
placeholderstring'Select color'The placeholder text

Emits

NameParametersDescription
update:modelValue(value: string | undefined)Triggered when the bound value is updated
change(value: string | undefined)Triggered when the color changes
clear()Triggered when the clear button is clicked