@abgov/angular-components

中文文档
6.2.0发布于 2026/10/31Apache-2.0TypeScriptES Module近 30 天下载 1.3万

Government of Alberta - UI components for Angular

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

Angular UI Components

npm version

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

Supported Angular versions: 18, 19, 20, and 21.

Install

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

Register the web components

Import the underlying web components once in your application entry point, before bootstrapping the application:

// src/main.ts
import "@abgov/web-components";

Keep your existing bootstrapApplication call after this import.

Import wrapper components

The Angular wrappers are standalone components. Import each wrapper directly into the standalone component that uses it:

// src/app/app.ts
import { Component } from "@angular/core";
import { GoabButton } from "@abgov/angular-components";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [GoabButton],
  template: `<goab-button type="primary">Continue</goab-button>`,
})
export class App {}

standalone: true is shown explicitly for compatibility with Angular 18; it is the default in newer Angular versions.

For an existing NgModule-based application, add each standalone wrapper component to that module's imports array. AngularComponentsModule is only needed by applications that still use the legacy goaValue, goaValueList, or goaChecked form directives.

Add styles

Import the component styles in src/styles.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 src/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>

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

版本与发布记录

@abgov/angular-components 共发布 327 个版本,首次发布于 2020/08/21;过去 12 个月发布了 95 个版本。

版本发布日期距今
6.2.0latest2026/10/316 天前
6.0.0-dev.11dev2026/10/298 天前
6.0.0-dev.102026/10/1720 天前
6.1.02026/10/1522 天前
6.0.0-dev.92026/10/1027 天前
6.0.0-dev.82026/10/1027 天前

其他发布通道:beta → 2.0.0-beta.1,alpha → 4.9.0-alpha.3,next → 5.0.0-next.1,dev → 6.0.0-dev.11。

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

@abgov/angular-components 是什么?

Government of Alberta - UI components for Angular

如何安装 @abgov/angular-components?

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

@abgov/angular-components 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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