@fluentui/font-icons-mdl2 (英语)
图标用于 流利的 UI 反应 (单位:千美元)之前的办公室 UI 纤维反应(中文(简体) )
Flient UI React 图标包括一个1100+图标的集合,可以在应用程序中使用.
开始
如果您正在使用 Fluent UI React 组件, 您可以调用所有图标 initializeIcons 函数从 @fluentui/font-icons-mdl2 软件包 :
import { initializeIcons } from '@fluentui/font-icons-mdl2';
// Register icons and pull the fonts from the default SharePoint cdn.
initializeIcons();
// ...or, register icons and pull the fonts from your own cdn:
initializeIcons('https://my.cdn.com/path/to/icons/');
这将使收藏中的所有图标都可以使用,但如果使用 @fluentui/style-utilities APIs 密码 getIcon 或者说 getIconClassName。 。 。 .
代码使用
图标组件
如果您正在使用流利的 UI React, 您可以使用 Icon 组件,并在相应的图标名称属性中传递,以渲染给定图标.
import { Icon } from '@fluentui/react/lib/Icon';
<Icon iconName="Snow" />;
getIconClassName API 密码
这个 @fluentui/style-utilities 软件包包括一个 getIconClassName API ,它可以提供用于手动渲染图标的 Css 类 :before 伪选取器 :
import { getIconClassName } from '@fluentui/style-utilities';
return `<i class="${getIconClassName('Snow')}" />`;
页:1
见 GitHub 图像 需要更多关于 Fluent UI React 项目和内部软件包的细节.