ColorIndicator 是一个 React 组件,用于在圆形中渲染特定颜色。它通常用于在子组件中总结已使用颜色的集合。

单个组件

简单颜色指示器

在侧边栏中使用

多个颜色指示器

用法

import { ColorIndicator } from '@wordpress/components';

const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;

属性

该组件接受以下 props:

className: string

用于 <span> 元素的额外类名。默认情况下仅添加 component-color-indicator。

  • 是否必需:否

colorValue: CSSProperties[ ‘background’ ]

指示器的颜色。支持 CSS background 属性的任何值。

  • 是否必需:是