@cypress-design/react-icon

中文文档
3.4.0发布于 2026/10/25MITTypeScriptESM + CJS近 30 天下载 6658

bash npm install @cypress-design/react-icon

原始使用文档

Icon

Install

npm install @cypress-design/react-icon

or with yarn

yarn add @cypress-design/react-icon

Usage

import Icon from '@cypress-design/react-icon'

The simple way using the Icon component

import Icon from '@cypress-design/react-icon'

export const MyButtonWithIcon = () => {
  return (
    <button className="border-1 flex items-center gap-[8px] border-red-500 p-[8px]">
      <Icon
        name="object-book"
        size="16"
        strokeColor="blue-600"
        fillColor="red-200"
        className="bg-red-100"
      />
      Read
    </button>
  )
}

We can also import each icon components separately. When we use named imports, the results becomes tree-shakable (more optimized). This means that the final bundle will not contain any of the unused icons code. Only imported icons will end up in your app or website js.

import { IconObjectBook } from '@cypress-design/react-icon'

export const MyButtonWithIcon = () => {
  return (
    <IconObjectBook size="16" strokeColor="indigo-600" fillColor="red-200" />
  )
}

Should you need to change the color of the icon on hover or focus prefix the props with these words.

Here, the strokeColor will change on hover from indigo to jade

import { IconObjectBook } from '@cypress-design/react-icon'

export const MyButtonWithIcon = () => {
  return (
    <button>
      <IconObjectBook
        size="16"
        strokeColor="indigo-600"
        hoverStrokeColor="jade-600"
      />
    </button>
  )
}

If you need the hover or focus effect to be triggered on the parent group, use interactiveColorsOnGroup. This prop will change all the pseudo prefixes to be group focused instead of triggered by the icon itself.

To achieve the same goal, in WindiCSS, we would use group-hover: instead of hover:.

import { IconObjectBook } from '@cypress-design/react-icon'

export const MyButtonWithIcon = () => {
  return (
    <button className="group flex items-center gap-[8px] hover:text-jade-800">
      <IconObjectBook
        size="48"
        strokeColor="indigo-600"
        hoverStrokeColor="jade-600"
        interactiveColorsOnGroup
      />
      Book
    </button>
  )
}

版本与发布记录

@cypress-design/react-icon 共发布 139 个版本,首次发布于 2022/05/18;过去 12 个月发布了 15 个版本。

版本发布日期距今
3.4.0latest2026/10/2516 天前
3.3.22026/10/051 个月前
3.3.12026/09/112 个月前
3.3.02026/07/293 个月前
3.2.02026/07/223 个月前
3.1.02026/07/213 个月前

其他发布通道:next → 2.0.0-next.0。

关于 @cypress-design/react-icon 的常见问题

@cypress-design/react-icon 是什么?

bash npm install @cypress-design/react-icon

如何安装 @cypress-design/react-icon?

在项目目录运行 npm install @cypress-design/react-icon,或使用 pnpm add / yarn add / bun add。

@cypress-design/react-icon 支持 TypeScript 吗?

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

@cypress-design/react-icon 支持 ESM 还是 CommonJS?

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

@cypress-design/react-icon 可以商用吗?

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

@cypress-design/react-icon 的下载量有多少?

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

@cypress-design/react-icon 还在维护吗?

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