@fluentui/react-docsite-components

中文文档
8.16.10发布于 2026/10/29MITTypeScriptESM + CJS近 30 天下载 3325

Fluent UI React components for building documentation sites.

原始使用文档

@fluentui/react-docsite-components

Components and utilities used to build internal documentation sites and inner loops for various Fluent UI React (formerly Office UI Fabric React) packages.

This package is in maintenance mode while we work on a replacement. It should only be used in new projects if you must have a published documentation site that looks like the official Fluent UI React docs. If all you need is an inner loop for component development, please use Storybook instead. Storybook is a well-supported, well-documented platform for component development and documentation.

Live editor support

To set up the live code editor in the demo app for a package other than the @fluentui/react package itself:

  1. Follow the setup steps from the @fluentui/monaco-editor readme (the helpers mentioned are also re-exported from @fluentui/react-monaco-editor for convenience).

  2. Set up a .d.ts rollup file for your package using API Extractor.

  3. Add a dependency on raw-loader to the package containing your demo app.

  4. Define the custom list of supported packages. For demonstration purposes, we'll assume:

    • You're building off the default set of supported packages
    • The package you're demoing is my-package
    • my-package re-exports another package called my-package-utilities (it's not required that your package export anything else, but this is included to demonstrate setting it up)
    • Each package's .d.ts rollup lives under <package-folder>/dist/<unscoped-package-name>.d.ts
import { IPackageGroup } from '@fluentui/react-monaco-editor';
import { defaultSupportedPackages } from '@fluentui/react-monaco-editor/lib/utilities/defaultSupportedPackages';

export const editorSupportedPackages: IPackageGroup[] = [
  ...defaultSupportedPackages,
  {
    // Package's exports will be made available under this global name at runtime
    globalName: 'MyPackage',
    // Loader for the package's contents
    loadGlobal: () => import('my-package'),
    // Alternatively, for non-delayed loading:
    //   loadGlobal: () => require('my-package'),
    // Or at the top of the file, `import * as MyPackage from 'my-package'`, then:
    //   loadGlobal: () => Promise.resolve(MyPackage)
    packages: [
      {
        packageName: 'my-package',
        loadTypes: () => {
          // Use import() so the types can potentially be split into a separate chunk and delay loaded.
          // If you don't care about that, you could use require() instead.
          // @ts-ignore: import is handled by webpack
          return import('!raw-loader!my-package/dist/my-package.d.ts');
        },
      },
      {
        // my-package re-exports my-package-utilities from its root, so it goes under the same global
        packageName: 'my-package-utilities',
        loadTypes: () => {
          // @ts-ignore: import is handled by webpack
          return import('!raw-loader!my-package-utilities/dist/my-package-utilities.d.ts');
        },
      },
    ],
  },
];
  1. To apply to a single ExampleCard:
import { editorSupportedPackages } from '<file path>';
import { MyExample } from './MyExample.Example';
const MyExampleCode = require('!raw-loader!./MyExample.Example.tsx');

<ExampleCard title="My example" code={MyExampleCode} editorSupportedPackages={editorSupportedPackages}>
  <MyExample />
</ExampleCard>;
  1. To apply to all ExampleCard instances in your app:
import { editorSupportedPackages } from '<file path>';
import { IExampleCardProps, IAppDefinition } from '@fluentui/react-docsite-components';

const exampleCardProps: IExampleCardProps = { editorSupportedPackages };

// same applies with ISiteDefinition
const appDefinition: IAppDefinition = {
  // ...
  theme: {
    components: {
      ExampleCard: {
        styles: exampleCardProps,
      },
    },
  },
};

版本与发布记录

@fluentui/react-docsite-components 共发布 731 个版本,首次发布于 2020/10/23;过去 12 个月发布了 12 个版本。

版本发布日期距今
8.16.10latest2026/10/2917 天前
8.16.92026/10/2620 天前
8.16.82026/10/011 个月前
8.16.72026/07/014 个月前
8.16.62026/05/265 个月前
8.16.52026/05/195 个月前

其他发布通道:beta → 8.0.0-beta.62。

关于 @fluentui/react-docsite-components 的常见问题

@fluentui/react-docsite-components 是什么?

Fluent UI React components for building documentation sites.

如何安装 @fluentui/react-docsite-components?

在项目目录运行 npm install @fluentui/react-docsite-components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=16.8.0 <20.0.0)、react-dom(>=16.8.0 <20.0.0)、@types/react(>=16.8.0 <20.0.0)、@types/react-dom(>=16.8.0 <20.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fluentui/react-docsite-components 支持 TypeScript 吗?

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

@fluentui/react-docsite-components 支持 ESM 还是 CommonJS?

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

@fluentui/react-docsite-components 可以商用吗?

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

@fluentui/react-docsite-components 的下载量有多少?

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

@fluentui/react-docsite-components 还在维护吗?

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