@fluentui/font-icons-mdl2

中文文档
8.5.76发布于 2026/10/26MITTypeScriptESM + CJS近 30 天下载 95.1万

Fluent UI React icon set.

原始使用文档
文档目录5 节
  1. Getting started
  2. Usage in code
  3. Icon component
  4. getIconClassName API
  5. Notes

@fluentui/font-icons-mdl2

Icons for Fluent UI React (formerly Office UI Fabric React)

Fluent UI React Icons includes a collection of 1100+ icons which you can use in your application.

Getting started

If you are using Fluent UI React components, you can make all icons available by calling the initializeIcons function from the @fluentui/font-icons-mdl2 package:

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/');

This will make ALL icons in the collection available, but will download them on demand when referenced using the @fluentui/style-utilities APIs getIcon or getIconClassName.

Usage in code

Icon component

If you are using Fluent UI React, you can use the Icon component and pass in the corresponding iconName property to render a given icon.

import { Icon } from '@fluentui/react/lib/Icon';

<Icon iconName="Snow" />;

getIconClassName API

The @fluentui/style-utilities package includes a getIconClassName API which can provide a css class to use for rendering the icon manually using the :before pseudoselector:

import { getIconClassName } from '@fluentui/style-utilities';

return `<i class="${getIconClassName('Snow')}" />`;

Notes

See GitHub for more details on the Fluent UI React project and packages within.

版本与发布记录

@fluentui/font-icons-mdl2 共发布 167 个版本,首次发布于 2020/10/23;过去 12 个月发布了 8 个版本。

版本发布日期距今
8.5.76latest2026/10/2620 天前
8.5.752026/10/011 个月前
8.5.742026/07/014 个月前
8.5.732026/05/116 个月前
8.5.722026/02/278 个月前
8.5.712026/01/279 个月前

其他发布通道:beta → 8.0.0-beta.19,lts-7 → 7.9.6。

关于 @fluentui/font-icons-mdl2 的常见问题

@fluentui/font-icons-mdl2 是什么?

Fluent UI React icon set.

如何安装 @fluentui/font-icons-mdl2?

在项目目录运行 npm install @fluentui/font-icons-mdl2,或使用 pnpm add / yarn add / bun add。

@fluentui/font-icons-mdl2 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fluentui/font-icons-mdl2 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fluentui/font-icons-mdl2 可以商用吗?

@fluentui/font-icons-mdl2 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fluentui/font-icons-mdl2 的下载量有多少?

根据 npm 官方下载统计,@fluentui/font-icons-mdl2 在 2026/10/15 – 2026/11/13 这 30 天内被下载 950,689 次,日均约 31,690 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fluentui/font-icons-mdl2 还在维护吗?

最新版本 8.5.76 发布于 2026/10/26(20 天前);至今共发布 167 个版本,其中过去 12 个月发布了 8 个;首次发布于 2020/10/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。