@ant-design/icons-angular

中文文档
22.1.1发布于 2026/09/18MITTypeScriptES Module近 30 天下载 56.4万

Ant Design Icons for Angular

原始使用文档
文档目录8 节
  1. Install
  2. Usage
  3. Namespace
  4. Development
  5. Setup
  6. Demo
  7. Build
  8. Extension

Ant Design Icons for Angular

NPM version NPM downloads

Install

ng add @ant-design/icons-angular

# or npm install @ant-design/icons-angular

Usage

You should import IconDirective in your component.

import { IconDirective } from '@ant-design/icons-angular';

@Component({
  imports: [ IconDirective ]
})
export class AppComponent {}

And register the icons you need to IconService (all or explicitly, we call it static loading):

ATTENTION! We strongly suggest you not to register all icons, which would increase the bundle size dramatically.

import { Component, inject } from '@angular/core';
import { IconService } from '@ant-design/icons-angular';
import { AccountBookFill } from '@ant-design/icons-angular/icons'
// import * as AllIcons from 'ant-icons-angular/icons';

@Component({
  // ...
})
export class AppComponent {
  readonly iconService = inject(IconService);
  
  constructor() {
    // Import all. NOT RECOMMENDED. ❌
    // const antDesignIcons = AllIcons as {
      // [key: string]: IconDefinition;
    // };
    // this.iconService.addIcon(...Object.keys(antDesignIcons).map(key => antDesignIcons[key]));

    // Import what you need! ✔️
    this.iconService.addIcon(...[ AccountBookFill ]);
    this.iconService.twoToneColor = { primaryColor: '#1890ff' };
  }
}

You can also provide icons you need in the app.config.ts:

import { ApplicationConfig } from '@angular/core';
import { provideAntIcons } from '@ant-design/icons-angular';
import { AccountBookFill } from '@ant-design/icons-angular/icons';

export const appConfig: ApplicationConfig = {
  providers: [
    provideAntIcons([ AccountBookFill ])
  ]
};

When you want to render an icon:

<span antIcon type="ant-cloud" theme="outline"></span>

Please checkout the demo for more details.

For icons provided by Ant Design, we provide dynamic loading strategy to reduce bundle's size. Just config your angular.json and even don't need to register the icons! Checkout the examples folder and angular.json for more details.

Namespace

Namespace allows users to register their own icons with simple API, support both dynamic loading and static loading.

If you want to add a panda icon in animal namespace:

  • for static loading, you can call addIconLiteral('animal:panda', '<svg>...</svg>');
  • for dynamic loading, just put panda.svg under assets/animal. And render a panda like: <span antIcon type="animal:panda">.

Please checkout the demo for more details.

Development

You can find the source code here.

Setup

Install dependencies of @ant-design/icons-angular, and run npm run generate.

Demo

Run npm run generate and then npm run start.

Build

Run npm run build:lib.

Extension

You can simply extend this package by creating directives or services that extends IconDirective and IconService. And it is worth mentioning that _changeIcon method returns a Promise<svg> using which you could add extra modifications.

ng-zorro-antd is a good example of extending this package.

版本与发布记录

@ant-design/icons-angular 共发布 62 个版本,首次发布于 2018/09/29;过去 12 个月发布了 9 个版本。

版本发布日期距今
22.1.1latest2026/09/181 个月前
22.1.02026/08/172 个月前
22.0.02026/06/055 个月前
22.0.0-beta.4beta2026/06/055 个月前
22.0.0-beta.32026/06/055 个月前
22.0.0-beta.22026/06/055 个月前

其他发布通道:next → 10.0.0-beta.0,beta → 22.0.0-beta.4。

关于 @ant-design/icons-angular 的常见问题

@ant-design/icons-angular 是什么?

Ant Design Icons for Angular

如何安装 @ant-design/icons-angular?

在项目目录运行 npm install @ant-design/icons-angular,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:rxjs(^6.5.3 || ^7.4.0)、@angular/core(^22.0.0)、@angular/common(^22.0.0)、@angular/platform-browser(^22.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ant-design/icons-angular 支持 TypeScript 吗?

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

@ant-design/icons-angular 支持 ESM 还是 CommonJS?

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

@ant-design/icons-angular 可以商用吗?

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

@ant-design/icons-angular 的下载量有多少?

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

@ant-design/icons-angular 还在维护吗?

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