@cypress-design/vue-icon

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

bash npm install @cypress-design/vue-icon

原始使用文档
文档目录4 节
  1. Install
  2. Usage
  3. Import
  4. Colors

Icon

Install

npm install @cypress-design/vue-icon

or with yarn

yarn add @cypress-design/vue-icon

Usage

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

Import

2 methods exist to load this component:

Use named imports of each icon you plan on using. I recommend this method because:

  • It's tree shakable: Only the icons you use will end up in your bundle
  • You get TS validation of color props: if a color is not available, squigles will appear in your editor
<script setup>
import { IconObjectBookCode } from '@cypress-design/vue-icon'
</script>

<template>
  <IconObjectBookCode />
</template>

Import the default Icon component and pass the name of the icon. It can be useful but you should avoid it in production unless you know what you are doing.

It has advantages:

  • Allows for quick browsing of the available icons right in the template
  • Allows passing ids around and delegating color and size until the implementation.

But drawbacks too:

  • it prevents tree shaking.
  • It uses TypeScript to check sizes and colors but with a twist:
    • If the size of the icon is not available for the icon selected and is available for another, the error will appear on the icon component instead of on the size prop.
<script setup>
import Icon from '@cypress-design/vue-icon'
</script>

<template>
  <Icon name="object-book-code" />
</template>

Colors

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

<script setup>
import { IconObjectBook } from '@cypress-design/vue-icon'
</script>

<template>
  <button class="flex items-center gap-[8px]">
    <IconObjectBook
      size="16"
      strokeColor="blue-600"
      hoverStrokeColor="jade-600"
    />Read
  </button>
</template>

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:.

<script setup>
import { IconObjectBook } from '@cypress-design/vue-icon'
</script>

<template>
  <button class="group flex items-center gap-[8px] hover:text-jade-800">
    <IconObjectBook
      size="16"
      strokeColor="blue-600"
      hoverStrokeColor="jade-600"
      interactiveColorsOnGroup
    />Read
  </button>
</template>

版本与发布记录

@cypress-design/vue-icon 共发布 143 个版本,首次发布于 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/vue-icon 的常见问题

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

bash npm install @cypress-design/vue-icon

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

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

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

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

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

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

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

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

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

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

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

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