ColorIndicator 是一个 React 组件,用于在圆圈中渲染特定颜色,常用于在子组件中汇总使用的颜色集合。它作为单个组件,主要在侧边栏中使用。
import { ColorIndicator } from '@wordpress/components';
const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;ColorIndicator is a React component that renders a specific color in a circle. It’s often used to summarize a collection of used colors in a child component.


import { ColorIndicator } from '@wordpress/components';
const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;
The component accepts the following props:
className: stringExtra classes for the used <span> element. By default only component-color-indicator is added.
colorValue: CSSProperties[ 'background' ]The color of the indicator. Any value from the CSS background property is supported.