@cypress-design/css

中文文档
1.3.0发布于 2026/06/11MITTypeScriptESM + CJS近 30 天下载 1.8万

We style every component using a utility first CSS framework: TailwindCSS. Install it in your project to render the components properly.

原始使用文档
文档目录12 节
  1. Install the CSS package in your dev dependencies:
  2. Typography
  3. For projects using this package:
  4. Using cyColors in stylesheets
  5. To use those css variables in the project using this packag…
  6. Remove Windi (if installed)
  7. Install Tailwind
  8. The simplest way
  9. The explicit way
  10. Install WindiCSS (deprecated)
  11. Webpack
  12. Vite

@cypress-design/css

We style every component using a utility first CSS framework: TailwindCSS. Install it in your project to render the components properly.

To do that, follow the two steps below:

Install the CSS package in your dev dependencies:

yarn add -D @cypress-design/css

Typography

The design system uses three brand fonts. Load them via Google Fonts — the CDN handles caching across Cypress products:

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Roboto:ital,wght@0,400;0,500;0,700;1,400&family=Roboto+Mono:wght@400;500;600;700&display=swap"
/>

The Tailwind font utilities exposed by this package:

ClassFontUse for
font-brand-headingPoppinsPage headings, display text
font-brandRobotoBody copy, UI labels
font-brand-monoRoboto MonoCode, tokens, monospaced values
font-systemSystem sans-serif stackFallback / system UI
font-system-monoSystem monospace stackFallback / system UI mono
font-monoSystem monospace stackConvenience alias for font-system-mono

For projects using this package:

We bundle all the css imported to any of the files in this package into one file in the dist folder - index.css so that users of this package can import the css styles of this package and use it in their projects.

Using cyColors in stylesheets

When building this package, we have a script generate-colors-css.ts to generate the file colors.css which recreates all the cyColors from color-constants.ts as css variables. If a color needs to be added or updated, only the object cyColors in color-constants.ts needs to be updated. Then, we need to rebuild the package so that colors.css can be regenerated so you should run:

cd css && yarn build

To use those css variables in the project using this package:

In your .css files add:

@import "@cypress-design/css/index.css";

In your .scss files add:

@use "@cypress-design/css/index.css" as *

and then you can use the variables from colors.css like this:

border: 1px solid var(--cy-gray-800);

Remove Windi (if installed)

If windicss is installed, uninstall it first:

  • remove the custom imports for windi import 'virtual:windi.css'
  • remove the plugin from webpack or from vite config

Install Tailwind

Install tailwind: Follow the tailwind docs

Finally update your tailwind config file.

The simplest way

This config is less verbose but only allows you to customize the files scanned.

// tailwind.config.cjs
const { TailwindConfig } = require('@cypress-design/css')

module.exports = TailwindConfig([
  './index.html',
  './src/**/*.{vue,js,ts,jsx,tsx}',
])

The explicit way

If you plan on configuring

// tailwind.config.cjs
const cypressCSS = require('@cypress-design/css')

/** @type {import('tailwindcss').Config} */
module.exports = {
  presets: [cypressCSS.TailwindConfig()],
  content: {
    files: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
    extract: ['vue', 'js', 'tsx'].reduce((acc, ext) => {
      acc[ext] = cypressCSS.TailwindIconExtractor
      return acc
    }, {}),
  },
}

Install WindiCSS (deprecated)

Webpack

const { CyCSSWebpackPlugin } = require('@cypress-design/css')

module.exports = {
  plugins: [
    CyCSSWebpackPlugin({
      scan: {
        include: ['src/**/*.@(tsx|ts|js|vue)'],
      },
    }),
  ],
}

Vite

import { defineConfig } from 'vite'
import { CyCSSVitePlugin } from '@cypress-design/css'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    CyCSSVitePlugin({
      scan: {
        include: ['/src/**/*.@(tsx|ts|js|vue)'],
      },
    }),
  ],
})

NOTE: Add your html page and all your react and vue component files to the scan.include array. This helps WindiCSS determine which class to include in the final generated CSS.

版本与发布记录

@cypress-design/css 共发布 43 个版本,首次发布于 2022/04/30;过去 12 个月发布了 1 个版本。

版本发布日期距今
1.3.0latest2026/06/114 个月前
1.2.02025/06/121.4 年前
1.1.02025/04/091.6 年前
2.0.0-next.0next2024/09/192 年前
1.0.02024/06/132 年前
0.19.22024/03/292 年前

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

@cypress-design/css 是什么?

We style every component using a utility first CSS framework: TailwindCSS. Install it in your project to render the components properly.

如何安装 @cypress-design/css?

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

@cypress-design/css 支持 TypeScript 吗?

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

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

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

@cypress-design/css 可以商用吗?

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

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

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

@cypress-design/css 还在维护吗?

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