UNPKG

@wordpress/components

Version:
46 lines (41 loc) 1.11 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * External dependencies */ import classnames from 'classnames'; /** * WordPress dependencies */ import { forwardRef } from '@wordpress/element'; /** * Internal dependencies */ function UnforwardedColorIndicator(props, forwardedRef) { const { className, colorValue, ...additionalProps } = props; return createElement("span", _extends({ className: classnames('component-color-indicator', className), style: { background: colorValue }, ref: forwardedRef }, additionalProps)); } /** * 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. * * ```jsx * import { ColorIndicator } from '@wordpress/components'; * * const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />; * ``` */ export const ColorIndicator = forwardRef(UnforwardedColorIndicator); export default ColorIndicator; //# sourceMappingURL=index.js.map