@ecoportal/icons

中文文档
3.5.0发布于 2026/10/19ISCTypeScriptESM + CJS零依赖近 30 天下载 2729

Icons for the EcoPortal design system

原始使用文档
文档目录15 节
  1. Development
  2. Adding/removing icons
  3. Icon Guidelines
  4. Linking without publishing
  5. Installation
  6. Usage
  7. 1. Standard import
  8. 2. Category import (recommended for multiple icons from the…
  9. 3. Direct component import (recommended for optimal bundle …
  10. Bundle Size Comparison
  11. Icon Properties
  12. Icon Naming Convention
  13. Available Categories
  14. Development
  15. Publish

@ecoportal/icons

NPM Package for ecoPortal React Icons in the design system. package.

Development

Adding/removing icons

The icon set is controlled by the src/icons directory. Any icons in there will be built via yarn icons. To add or remove icons just add or remove the .svg file.

Icon Guidelines

All icons in the src/icons directory should be in a top level Category folder e.g. Buildings/building-single.svg. The icons are served via an svg file. If an svg is made of all single color paths then they should not have a fill set to allow easy styling wherever imported.

Linking without publishing

If you wish to add icons to the package and test them somewhere else without publishing in this repo run npm link to create a global link on your machine. Then, navigate to the other project consuming @ecoportal/icons and run npm link @ecoportal/icons in that project. This will create a symlink between the local build of this package and what is consumed in the other project. Once happy publish.

EcoPortal Icons

A collection of SVG icons for the EcoPortal design system, optimized for tree shaking.

Installation

npm install @ecoportal/icons
# or
yarn add @ecoportal/icons

Usage

There are three ways to import icons, each with different implications for bundle size:

1. Standard import

Import all icons from the main entry point:

import {
  EpBusinessCalendarFill,
  EpCommunicationChatFill,
} from "@ecoportal/icons";

const MyComponent = () => (
  <div>
    <EpBusinessCalendarFill />
    <EpCommunicationChatFill />
  </div>
);

While this approach is convenient, it may result in a larger bundle size if you're only using a few icons.

If you need multiple icons from the same category, you can import the entire category:

import * as BusinessIcons from "@ecoportal/icons/Business";

const MyComponent = () => (
  <div>
    <BusinessIcons.EpBusinessCalendarFill />
    <BusinessIcons.EpBusinessBriefcaseFill />
  </div>
);

This approach reduces bundle size significantly, as it only includes icons from a specific category.

For maximum optimization, you can import each icon directly from its category:

import EpBusinessCalendarFill from "@ecoportal/icons/Business/EpBusinessCalendarFill";

const MyComponent = () => (
  <div>
    <EpBusinessCalendarFill />
  </div>
);

This method ensures the smallest possible bundle size, as it imports only the exact icon needed.

Bundle Size Comparison

Import MethodBundle SizeSavings vs Standard Import
Standard Import~3.5 MB-
Category Import~250 KB~93%
Direct Import~3 KB~99.9%

Icon Properties

All icons accept standard SVG and React props:

<EpBusinessCalendarFill
  color="red"
  size={24}
  className="my-icon-class"
  onClick={() => console.log("Icon clicked")}
/>

Icon Naming Convention

All icons follow a consistent naming pattern:

Ep[Category][Name][Style]

For example:

  • EpBusinessCalendarFill - A filled calendar icon from the Business category
  • EpCommunicationChatLine - An outlined chat icon from the Communication category

Available Categories

  • Actions
  • Buildings
  • Business
  • Communication
  • Custom
  • Design
  • Development
  • Device
  • Document
  • Editor
  • Finance
  • Health
  • Logos
  • Map
  • Media
  • Others
  • System
  • User
  • Weather

Development

To add new icons to the package:

  1. Add SVG files to the appropriate directory in src/icons/
  2. Increase the package version in package.json
  3. Run yarn build to compile the package
  4. Use yarn test to test the tree shaking effectiveness
  5. (Optional) Add a new mapping to iconMapping.js (for angular names only)

Publish

  1. Run yarn build to bundle the icons for publishing.
  2. Run yarn publish to publish the new icons to NPM.

Note: only run yarn publish after the changes have been reviewed. Package version will change after publish.

版本与发布记录

@ecoportal/icons 共发布 79 个版本,首次发布于 2023/04/19;过去 12 个月发布了 27 个版本。

版本发布日期距今
3.5.0latest2026/10/1925 天前
3.4.12026/09/171 个月前
3.3.22026/09/022 个月前
3.3.12026/09/012 个月前
3.3.02026/08/312 个月前
3.2.12026/08/282 个月前

关于 @ecoportal/icons 的常见问题

@ecoportal/icons 是什么?

Icons for the EcoPortal design system

如何安装 @ecoportal/icons?

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

@ecoportal/icons 支持 TypeScript 吗?

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

@ecoportal/icons 支持 ESM 还是 CommonJS?

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

@ecoportal/icons 可以商用吗?

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

@ecoportal/icons 的下载量有多少?

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

@ecoportal/icons 还在维护吗?

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