@freightos/icons

中文文档
3.0.1发布于 2026/04/05MITTypeScriptESM + CJS零依赖近 30 天下载 1976

Frederos 应用程序的完整图标库, 并有完整的 TypeScript 支持

中文使用文档
文档目录20 节
  1. 特征
  2. 安装
  3. 使用指南
  4. 基本用途
  5. 道具
  6. 大小
  7. 颜色
  8. 交互式图标
  9. 使用参考文献
  10. 类型脚本支持
  11. 使用图标类型
  12. 动态图标选择
  13. 可用图标
  14. 图标命名公约
  15. 发展
  16. 添加新图标
  17. 可用的脚本
  18. 出版
  19. 维护者
  20. 许可证

@freightos/相册

一个综合图标库,有280个SVG图标,为Frederos应用程序所设计. 由React所建,TypeScript所建,并铭记开发者的经验.

这个包裹住在 货运窗口 单重键 : packages/icons/。 。 。 .

特征

  • 🎨 280 图标 - 全套专业设计的图标
  • 📦 树能震动 - 只导入你需要的东西
  • 🔷 类型脚本第一 - 包括全部类型定义
  • ⚡ 双格式 - 包括无害环境管理和共同司法体系建设
  • 🎯 语义大小 - 使用( I) xs (12页x), sm (16个px), md (24个px), lg (32px)或任何数字/字符串
  • 🎨 可主题 - 用途 currentColor 以容易为目的
  • ♿ 可访问 - 通过SVG道具提供适当的ARIA支助
  • 🪶 轻巧 - 个人图标很小
  • ⚛️ 反应 16.8+ - 使用钩子和现代反应

安装

npm install @freightos/icons
# or
yarn add @freightos/icons
# or
pnpm add @freightos/icons

Monorepo 用户 : 在FrederWind repo内,图标通过 workspace:* - 不需要安装.

使用指南

基本用途

直接从包中导入图标 :

import { IconSearch, IconUser, IconDashboard } from '@freightos/icons';

function MyComponent() {
  return (
    <div>
      <IconSearch size={24} />
      <IconUser color="blue" />
      <IconDashboard className="my-icon" />
    </div>
  );
}

道具

所有图标接受以下道具:

Prop类型默认说明
sizeIconSize | number | string'1em'宽度和高度——语义符号(xs, (中文(简体) ), sm, (中文(简体) ), md, (中文(简体) ), lg),像素数字,或 CSS 字符串
colorFreightosColor | string'currentColor'图标的颜色 - 支持具有自动完成或任何 CSS 颜色值的设计系统颜色
classNamestring- 说吧补充CSS类
...propsSVGProps<SVGSVGElement>- 说吧任何有效的 SVG 属性

大小

图标默认是响应的,并且与母字体大小相适应。 可以多种方式自定义大小 :

// Default size (1em - scales with font-size)
<IconSearch />

// Numeric size (pixels)
<IconSearch size={24} />
<IconSearch size={32} />

// String size (CSS units)
<IconSearch size="2rem" />
<IconSearch size="24px" />

// Responsive with parent font-size
<div className="text-lg">
  <IconSearch /> {/* Icon automatically scales */}
</div>

// Using CSS classes (Tailwind example)
<IconSearch className="w-6 h-6" />

颜色

图标使用 currentColor 默认,使其易于主题。 这个 color 道克支持 Frederos 设计系统颜色并带有自动完成,加上任何 CSS 颜色值 :

// Freightos design system colors (with autocomplete!)
<IconSearch color="blue" />
<IconError color="red" />
<IconWarning color="yellow" />
<IconSuccess color="green" />

// Inherits parent text color
<div className="text-blue-500">
  <IconSearch />
</div>

// Any CSS color value
<IconSearch color="#1890ff" />
<IconSearch color="var(--primary-color)" />

// Using CSS classes
<IconSearch className="text-blue-500" />
<IconSearch className="text-gray-900 dark:text-white" />

可用的设计系统颜色

下列Frederos设计系统颜色可自动支持:

蓝: blue-10, (中文(简体) ), blue-20, (中文(简体) ), blue, (中文(简体) ), blue-40, (中文(简体) ), blue-50

红: red-10, (中文(简体) ), red-20, (中文(简体) ), red, (中文(简体) ), red-40, (中文(简体) ), red-50

黄: yellow-10, (中文(简体) ), yellow-20, (中文(简体) ), yellow, (中文(简体) ), yellow-30, (中文(简体) ), yellow-40, (中文(简体) ), yellow-50

绿: green-10, (中文(简体) ), green-20, (中文(简体) ), green, (中文(简体) ), green-40, (中文(简体) ), green-50

灰色: white, (中文(简体) ), gray-05, (中文(简体) ), gray-10, (中文(简体) ), gray-20, (中文(简体) ), gray-30, (中文(简体) ), gray-40, (中文(简体) ), gray-50, (中文(简体) ), gray-60, (中文(简体) ), gray-70, (中文(简体) ), gray-80, (中文(简体) ), gray-90, (中文(简体) ), gray

紫外线: purple-10, (中文(简体) ), purple

特殊 : transparent

交互式图标

// With click handler
<IconSearch
  onClick={() => console.log('Search clicked')}
  className="cursor-pointer"
/>

// With hover effects
<IconSearch className="hover:text-blue-500 transition-colors" />

// As a button
<button>
  <IconSearch size={20} />
  Search
</button>

使用参考文献

import { useRef } from 'react';
import { IconSearch } from '@freightos/icons';

function Component() {
  const iconRef = useRef<SVGSVGElement>(null);

  return <IconSearch ref={iconRef} />;
}

类型脚本支持

使用图标类型

这个 Icon 类型允许您创建具有图标组件的类型安全变量:

import { Icon, IconSearch, IconUser, IconDashboard } from '@freightos/icons';

// Define an interface with an icon property
interface NavItem {
  title: string;
  icon: Icon;  // Type for icon components
  path: string;
}

// Assign icon components (not JSX elements)
const navItems: NavItem[] = [
  { title: 'Search', icon: IconSearch, path: '/search' },
  { title: 'Profile', icon: IconUser, path: '/profile' },
  { title: 'Dashboard', icon: IconDashboard, path: '/dashboard' },
];

// Use in your component
function Navigation() {
  return (
    <nav>
      {navItems.map(item => {
        const IconComponent = item.icon;
        return (
          <a key={item.title} href={item.path}>
            <IconComponent size={20} />
            <span>{item.title}</span>
          </a>
        );
      })}
    </nav>
  );
}

动态图标选择

import { Icon, IconSearch, IconUser, IconDashboard } from '@freightos/icons';

const iconMap: Record<string, Icon> = {
  search: IconSearch,
  user: IconUser,
  dashboard: IconDashboard,
};

function DynamicIcon({ name }: { name: string }) {
  const IconComponent = iconMap[name];

  if (!IconComponent) {
    console.warn(`Icon "${name}" not found`);
    return null;
  }

  return <IconComponent size={24} />;
}

可用图标

所有217个图标均可使用,按类别排列:

  • 导航:搜索,菜单打开,菜单关闭,ArrowBack,ArrowForward,CaretUp,CaretDown等.
  • 行动: 编辑、 回收站、 保存、 复制、 检查、 关闭、 附加、 最小值、 刷新等 .
  • 运输: ModeAir,ModeShip,ModeTruck,ModeTrain,ModeAirExpress等.
  • 商业:公司,工厂,仓库,办公室,账单,工资,钱库等.
  • 通讯: 消息、呼叫、信封、聊天进展、通知 钟等.
  • 用户:用户,用户循环,People,AddPerson等.
  • 状态:警报循环、信息循环、检查循环、核实、等待等.
  • 文档:文档,文档,下载,上传,存档,附件等.
  • 接口: Dashboard,设置,过滤器,列表,网格,表格,平板等.
  • 后勤: 集装箱,盒子,花板,克勒特,海关,保险,港口等.

参见您的 IDE 自动完成所有217 图标的完整列表 .

图标命名公约

图标遵循一致的命名模式:

  • SVG 文件名 : search.svg • 构成部分: IconSearch
  • SVG 文件名 : menu-open.svg • 构成部分: IconMenuOpen
  • SVG 文件名 : mode-air-express.svg • 构成部分: IconModeAirExpress

发展

添加新图标

  1. 将您的 SVG 文件添加到 packages/icons/svg/ (使用 kebab 大小写命名 : my-icon.svg(中文(简体) )
  2. 生成反应组件 :
pnpm --filter @freightos/icons run generate

这将:

  • 在 src/icons/
  • 用导出更新索引文件
  • 将硬码颜色替换为 currentColor
  1. 构建软件包 :
pnpm --filter @freightos/icons run build

可用的脚本

# Generate icons from SVG files
pnpm --filter @freightos/icons run generate

# Build all formats (ESM + CJS + Types)
pnpm --filter @freightos/icons run build

# Generate and build in one command
pnpm --filter @freightos/icons run dev

# Clean build output
pnpm --filter @freightos/icons run clean

出版

软件包以 npm 的形式发布 @freightos/icons数字 :

pnpm --filter @freightos/icons run release:patch   # 1.0.12 → 1.0.13
pnpm --filter @freightos/icons run release:minor   # 1.0.12 → 1.1.0
pnpm --filter @freightos/icons run release:major   # 1.0.12 → 2.0.0

维护者

维护者 吉里·纳斯拉维 (单位:千美元)jiries @ freightos.com (法语)(中文(简体) )

许可证

麻省理工学院

版本与发布记录

@freightos/icons 共发布 20 个版本,首次发布于 2025/11/02;过去 12 个月发布了 13 个版本。

版本发布日期距今
3.0.1latest2026/04/057 个月前
3.0.02026/04/027 个月前
1.0.172026/03/168 个月前
1.0.162026/03/168 个月前
1.0.152026/03/108 个月前
1.0.122026/01/0910 个月前

关于 @freightos/icons 的常见问题

@freightos/icons 是什么?

Frederos 应用程序的完整图标库, 并有完整的 TypeScript 支持

如何安装 @freightos/icons?

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

@freightos/icons 支持 TypeScript 吗?

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

@freightos/icons 支持 ESM 还是 CommonJS?

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

@freightos/icons 可以商用吗?

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

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

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

@freightos/icons 还在维护吗?

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