Ant Design Icons
⭐ The abstract trees of the Ant Design SVG icons.
[![NPM version](https://img.shields.io/npm/v/@ant-design/icons.svg?style=flat)](https://npmjs.org/package/@ant-design/icons)
[![NPM downloads](http://img.shields.io/npm/dm/@ant-design/icons.svg?style=flat)](https://npmjs.org/package/@ant-design/icons)
## Install
```bash
yarn add @ant-design/icons # or npm install @ant-design/icons --save
```
## Use Library Adapter
- React: See [@ant-design/icons-react](../icons-react) to learn about detail usage.
## Basic Usage
```ts
import { AlertOutline } from '@ant-design/icons';
// or import AlertOutline from '@ant-design/icons/lib/outline/AlertOutline';
console.log(AlertOutline);
// Output:
// {
// name: 'alert',
// theme: 'outline',
// icon: {
// tag: 'svg',
// attrs: { viewBox: '64 64 896 896' },
// children: [
// {
// tag: 'path',
// attrs: {
// d: 'M193 796a32 32 0 0 0 32 32h574a32....'
// }
// }
// ]
// }
// }
```
- Interfaces
This library export all SVG files as `IconDefinition`.
```ts
interface AbstractNode {
tag: string;
attrs: {
[key: string]: string;
};
children?: AbstractNode[];
}
interface IconDefinition {
name: string; // kebab-case-style
theme: ThemeType;
icon:
| ((primaryColor: string, secondaryColor: string) => AbstractNode)
| AbstractNode;
}
```
## Render Helpers
```ts
import { AccountBookFill } from '@ant-design/icons';
import { renderIconDefinitionToSVGElement } from '@ant-design/icons/lib/helpers';
const svgHTMLString = renderIconDefinitionToSVGElement(
AccountBookFill,
{ extraSVGAttrs: { width: '1em', height: '1em', fill: 'currentColor' } }
);
console.log(svgHTMLString);
// Output:
// ''
```
- Interfaces
```ts
declare function renderIconDefinitionToSVGElement(icon: IconDefinition, options?: HelperRenderOptions): string;
interface HelperRenderOptions {
placeholders?: {
primaryColor?: string; // default #333
secondaryColor?: string; // default #E6E6E6
};
extraSVGAttrs?: {
[key: string]: string;
};
}
```
## Build Project
```bash
npm run generate # Generate files to ./src
npm run build # Build library
npm run test # Runing Test
```