@financial-times/o-loading

中文文档
6.0.1发布于 2026/02/26MITES Module零依赖近 30 天下载 5964

A visual loading indicator, available in two colours and four sizes

原始使用文档
文档目录6 节
  1. Usage
  2. Markup
  3. Sass
  4. Migration guide
  5. Contact
  6. Licence

o-loading

This is an Origami component that provides a visual loading indicator.

Usage

Check out how to include Origami components in your project to get started with o-loading.

Markup

In order to display a loading indicator in your product, you will need to supply the theme and the size modifiers in your markup, e.g.:

<div class="o-loading o-loading--light o-loading--small"></div>

Sass

In order to output all of the variations in theme and size of o-loading, you'll need to include the following:

@import '@financial-times/o-loading/main';

@include oLoading();

You can also be more selective about which themes or sizes of the loading indicator you wish to output, by using a map. The $opts map accepts two lists:

'themes':

  • light
  • dark

And 'sizes':

  • mini
  • small
  • medium
  • large
@import '@financial-times/o-loading/main';

@include oLoading(
    $opts: (
        'themes': (
            'light',
        ),
        'sizes': (
            'medium',
            'large',
        ),
    )
);

// outputs a large light spinner and a medium light spinner

If you need to build a loading spinner into a component, for example, you can use the following mixin:

@import '@financial-times/o-loading/main';

.my-loading-spinner {
    @include oLoadingContent(
        $opts: (
            'theme': 'light',
            'size': 'small',
        )
    );
}

Migration guide

StateMajor VersionLast Minor ReleaseMigration guide
⚠ maintained6N/Amigrate to v6
╳ deprecated55.2migrate to v5
╳ deprecated44.0.4migrate to v4
╳ deprecated33.1migrate to v3
╳ deprecated22.3migrate to v2
╳ deprecated11.0-

Contact

If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #origami-support or email Origami Support.

Licence

This software is published by the Financial Times under the MIT licence.

版本与发布记录

@financial-times/o-loading 共发布 23 个版本,首次发布于 2019/02/13;过去 12 个月发布了 1 个版本。

版本发布日期距今
6.0.1latest2026/02/268 个月前
6.0.02025/02/201.7 年前
5.2.32023/10/273 年前
5.2.22023/04/283 年前
5.2.12022/01/134 年前
5.2.02021/11/254 年前

其他发布通道:prerelease → 5.0.0-beta.0。

关于 @financial-times/o-loading 的常见问题

@financial-times/o-loading 是什么?

A visual loading indicator, available in two colours and four sizes

如何安装 @financial-times/o-loading?

在项目目录运行 npm install @financial-times/o-loading,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@financial-times/o-brand(^4.1.0)、@financial-times/sass-mq(^5.0.2)、@financial-times/o-private-foundation(^1.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@financial-times/o-loading 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/financial-times__o-loading 是否存在。

@financial-times/o-loading 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@financial-times/o-loading 可以商用吗?

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

@financial-times/o-loading 的下载量有多少?

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

@financial-times/o-loading 还在维护吗?

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