@eqtylab/equality

中文文档
5.4.2发布于 2026/11/10Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 9939

EQTYLab's component and token-based design system

原始使用文档
文档目录9 节
  1. Installation
  2. Setup
  3. Tailwind CSS v4 (recommended)
  4. Without Tailwind
  5. Usage
  6. Themes
  7. Entry points
  8. Accessibility
  9. License

@eqtylab/equality

npm version license

EQTY Lab's design system: accessible React components and design tokens, built on Radix UI and Tailwind CSS v4.

Documentation · Components · GitHub

Installation

npm install @eqtylab/equality
# or
pnpm add @eqtylab/equality
# or
yarn add @eqtylab/equality

Requires react and react-dom 18.2 or newer.

Setup

Import the theme config, then a preflight, in your global stylesheet:

@import '@eqtylab/equality/theme-config.css';
@import '@eqtylab/equality/preflight.css' layer(base);

theme-config.css must come first, because it declares the layer order the preflight relies on. It builds on Tailwind, so tailwindcss v4 must be installed in your project.

StylesheetContains
@eqtylab/equality/theme-config.cssTokens, theme, utilities and components. No reset.
@eqtylab/equality/preflight.cssBase styles reset for html and everything under it.
@eqtylab/equality/preflight-scoped.cssThe same reset, only inside [data-equality-root].

If you're embedding Equality in a site that has its own base styles, use preflight-scoped.css instead so the reset doesn't affect the rest of the page.

Without Tailwind

Wrap your app, or the part of it that uses Equality, in ThemeProvider:

import { ThemeProvider } from '@eqtylab/equality';

export function Root() {
  return (
    <ThemeProvider>
      <App />
    </ThemeProvider>
  );
}

See the Usage guide for embedding in host sites, shadow DOM, and portalled surfaces.

Usage

import { Button, Card, CardContent } from '@eqtylab/equality';

export function Example() {
  return (
    <Card>
      <CardContent>
        <Button>Save changes</Button>
      </CardContent>
    </Card>
  );
}

Every component accepts a className prop for local style overrides. Component styles are scoped with CSS Modules, so overrides don't leak into other components.

Themes

Equality ships light and dark themes. Set the active theme on the root element:

<html data-equality-theme="dark"></html>

To apply a stored or system preference before first paint, inline the initializeTheme script in your document <head>:

import { initializeTheme } from '@eqtylab/equality/scripts';

<head>
  <script>{initializeTheme()}</script>
</head>;

See Themes for options.

Entry points

Import pathContents
@eqtylab/equalityComponents, ThemeProvider, and hooks
@eqtylab/equality/scriptsinitializeTheme inline script for theme startup
@eqtylab/equality/syntax-languageFile name to syntax grammar mapping for CodeBlock
@eqtylab/equality/theme-config.cssTailwind v4 theme config
@eqtylab/equality/preflight.cssGlobal base styles reset
@eqtylab/equality/preflight-scoped.cssBase styles reset scoped to [data-equality-root]

The package ships ES modules and CommonJS builds with TypeScript types.

Accessibility

Components are built on Radix UI primitives and designed for keyboard navigation and screen readers.

License

Apache-2.0

版本与发布记录

@eqtylab/equality 共发布 111 个版本,首次发布于 2026/01/28;过去 12 个月发布了 111 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.4.2latest2026/11/103 天前
5.4.12026/11/104 天前
5.4.02026/11/104 天前
5.3.42026/11/077 天前
5.3.32026/11/068 天前
5.3.22026/11/0310 天前

关于 @eqtylab/equality 的常见问题

@eqtylab/equality 是什么?

EQTYLab's component and token-based design system

如何安装 @eqtylab/equality?

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

@eqtylab/equality 支持 TypeScript 吗?

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

@eqtylab/equality 支持 ESM 还是 CommonJS?

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

@eqtylab/equality 可以商用吗?

@eqtylab/equality 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@eqtylab/equality 的下载量有多少?

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

@eqtylab/equality 还在维护吗?

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