Skip to content

ColorPicker 颜色选择框

规则

基础示例

Props 配置示例

禁用透明度

预设颜色

尺寸对比(小 / 中 / 大)

禁用

Events 事件示例

监听颜色变化

颜色选择后联动更新

完整配置项:TDesign_ColorPicker

valuestring

Props

参数说明类型默认值版本
borderless无边框模式booleanfalse-
clearable是否可清空booleanfalse-
colorModes颜色模式Array<'monochrome' | 'linear-gradient'>['monochrome','linear-gradient']-
disabled是否禁用boolean--
enableAlpha是否开启透明通道booleanfalse-
enableMultipleGradient是否允许点击渐变轴增加梯度booleantrue-
format格式化色值HEX | HEX8 | RGB | RGBA | HSL | HSLA | HSV | HSVA | CMYK | CSSRGB-
inputProps透传 Input 属性InputProps--
popupProps透传 Popup 属性PopupProps--
recentColors最近使用颜色(v-model:recentColors)Array<string> | boolean | null[]-
defaultRecentColors非受控最近使用颜色Array<string> | boolean | null[]-
selectInputProps透传 SelectInput 属性SelectInputProps--
showPrimaryColorPreview是否展示颜色预览区域booleantrue-
size尺寸small | medium | largemedium-
swatchColors系统预设色样(null/[] 不显示,undefined 用内置)Array<string> | null--
value色值string--
defaultValue非受控色值string--

Events

事件说明类型版本
change色值变化(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger }) => void-
clear清空(context: { e: MouseEvent }) => void-
paletteBarChange调色板控制器值变化(context: { color: ColorObject }) => void-
recentColorsChange最近使用颜色变化(value: Array<string>) => void-

FormCreate 是一个开源项目,基于 MIT 许可证发布,欢迎个人和企业用户免费使用