查看 WordPress Storybook 以获取更详细、交互式的文档。
渲染一个没有任何初始样式或包装器的原始图标。
import { wordpress } from '@wordpress/icons';
<Icon icon={ wordpress } />
Props
icon
- 类型:
IconType | null - 是否必需:否
- 默认值:
null
要渲染的图标。在大多数情况下,您应该使用来自@wordpress/icons 包的图标。
其他支持的值包括:组件实例、函数、
Dashicons
(指定为字符串)以及 null。
size 值以及其他任何附加 props 将会被透传。
size
- 类型:
number - 是否必需:否
- 默认值:
'string' === typeof icon ? 20 : 24
图标的尺寸(宽度和高度)。
当 icon 是字符串时(即 Dashicon ID),默认为 20,否则为 24。