Icon 组件用于渲染原始图标,不包含初始样式或包装器。它支持多种图标类型,包括来自 @wordpress/icons 包的图标、组件实例、函数和 Dashicons。
import { wordpress } from '@wordpress/icons';
<Icon icon={ wordpress } />See the WordPress Storybook for more detailed, interactive documentation.
Renders a raw icon without any initial styling or wrappers.
import { wordpress } from '@wordpress/icons';
<Icon icon={ wordpress } />
iconIconType | nullnullThe icon to render. In most cases, you should use an icon from
the @wordpress/icons package.
Other supported values are: component instances, functions,
Dashicons
(specified as strings), and null.
The size value, as well as any other additional props, will be passed through.
sizenumber'string' === typeof icon ? 20 : 24The size (width and height) of the icon.
Defaults to 20 when icon is a string (i.e. a Dashicon id), otherwise 24.