@abgov/react-components

中文文档
8.2.0发布于 2026/10/31Apache-2.0TypeScriptESM + CJS零依赖近 30 天下载 1.4万

Government of Alberta - UI components for React

原始使用文档
文档目录5 节
  1. Install
  2. Register the web components
  3. Add styles
  4. Add icons
  5. Use a component

React UI Components

npm version

React wrappers for the Government of Alberta Design System web components.

Supported React versions: 17, 18, and 19.

Install

npm i @abgov/react-components @abgov/web-components @abgov/ui-components-common

Register the web components

Import the underlying web components once in your application entry point, such as src/main.tsx:

import "@abgov/web-components";

Add styles

Import the component styles in your main stylesheet, such as src/index.css. This stylesheet includes the design tokens and dark theme overrides:

@import "@abgov/web-components/index.css";

Add icons

Add Ionicons to the <head> of index.html:

<script
  type="module"
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ionicons/ionicons.esm.js"
  integrity="sha384-QeK0N4dchhCMcoF1OkHAcgwR00gJv1uQr15TCJ5CXEcLF0wm8HC4QbtQzJMCTO+c"
  crossorigin="anonymous"
></script>

Use a component

import { GoabButton } from "@abgov/react-components";

export function App() {
  return <GoabButton type="primary">Continue</GoabButton>;
}

See the developer setup guide and Government of Alberta Design System for more information.

版本与发布记录

@abgov/react-components 共发布 670 个版本,首次发布于 2020/10/20;过去 12 个月发布了 119 个版本。

版本发布日期距今
8.2.0latest2026/10/316 天前
8.0.0-dev.12dev2026/10/316 天前
8.0.0-dev.112026/10/307 天前
8.0.0-dev.102026/10/298 天前
8.0.0-dev.92026/10/1720 天前
8.1.02026/10/1522 天前

其他发布通道:beta → 3.4.0-beta.65,BUGFIX → 4.13.2,alpha → 6.9.0-alpha.2,next → 7.0.0-next.1,dev → 8.0.0-dev.12。

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

@abgov/react-components 是什么?

Government of Alberta - UI components for React

如何安装 @abgov/react-components?

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

@abgov/react-components 支持 TypeScript 吗?

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

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

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

@abgov/react-components 可以商用吗?

@abgov/react-components 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

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

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

@abgov/react-components 还在维护吗?

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