@cycomdatasystems/headwindui

中文文档
1.10.0发布于 2026/11/11MITTypeScriptESM + CJS近 30 天下载 3098

A React UI component library built with Tailwind CSS, Headless UI, and Motion

原始使用文档
文档目录9 节
  1. Install
  2. Peer Dependencies
  3. Optional Peer Dependencies
  4. Usage
  5. Theming (light / dark / system)
  6. For AI tooling
  7. Development
  8. Naming Convention
  9. License

@cycomdatasystems/headwindui

A React UI component library built with Tailwind CSS, Headless UI, and Motion. WCAG 2.1 AA compliant.

Install

npm install @cycomdatasystems/headwindui

Peer Dependencies

These packages are required and must be installed by the consuming application:

npm install react react-dom @headlessui/react @heroicons/react @tanstack/react-table motion tailwindcss
PackageVersionUsed by
react>=18All components
react-dom>=18All components
@headlessui/react^2.0Checkbox, Combobox, Drawer, Menu, Modal, Select, and others
@heroicons/react^2.0Banner, BottomSheet, Chip, Combobox, DatePicker, Drawer, Table
@tanstack/react-table^8.0Table
motion>=11All animated components
tailwindcss^4.0All components (styling)

Optional Peer Dependencies

These are only needed if you use the specific components listed:

# For HWDatePicker
npm install date-fns react-day-picker

# For HWToast / hwToast
npm install react-hot-toast
PackageVersionUsed by
date-fns^3.0 || ^4.0DatePicker
react-day-picker^9.0DatePicker
react-hot-toast^2.4Toast

Usage

import { HWButton, HWModal, hwToast } from "@cycomdatasystems/headwindui";
import "@cycomdatasystems/headwindui/styles.css";

⚠️ The styles.css import is required. It contains the @theme declaration that registers every hw-* design token (bg-hw-primary, text-hw-surface, text-hw-danger, rounded-hw-md, outline-hw-focus-ring, etc.) plus their .dark overrides. Without it, every HW component renders unstyled — buttons have no background, inputs have no borders, required-field asterisks are invisible. Adding a Tailwind v4 @source directive pointing at the package does not substitute for this import: @source only controls class-string scanning, it does not register design tokens.

Theming (light / dark / system)

Wrap your app in <HWThemeProvider> and drop <HWThemeToggle> wherever you want the switcher. The hook useTheme() exposes { mode, resolved, setMode }.

import { HWThemeProvider, HWThemeToggle } from "@cycomdatasystems/headwindui";

export function App() {
  return (
    <HWThemeProvider>
      <HWThemeToggle />
      {/* …rest of your app… */}
    </HWThemeProvider>
  );
}

To prevent a flash of the wrong theme on first paint, inline this script in <head> before React mounts:

<script>
  (function () {
    try {
      var s = localStorage.getItem('headwind_theme') || 'system';
      var dark = s === 'dark' || (s === 'system' && matchMedia('(prefers-color-scheme: dark)').matches);
      if (dark) document.documentElement.classList.add('dark');
      document.documentElement.setAttribute('data-theme', s);
    } catch (e) {}
  })();
</script>

For AI tooling

The full usage guide (AI_AGENT_GUIDE.md) and a compact component-selection manifest (COMPONENT_INDEX.yaml) ship inside the published package so AI coding agents running in a consuming app can read accurate, version-pinned guidance from node_modules without cloning this repo. Resolve them via the package's subpath exports:

require.resolve("@cycomdatasystems/headwindui/agent-guide"); // → dist/AI_AGENT_GUIDE.md
require.resolve("@cycomdatasystems/headwindui/manifest");    // → dist/manifest/COMPONENT_INDEX.yaml

The manifest is stamped with _packageVersion at the top so tools can detect when a cached copy has gone stale relative to the installed version.

Development

# Install dependencies
npm install

# Start Storybook
npm run storybook

# Run tests
npm test

# Build the library
npm run build

Naming Convention

All exported components use the HW prefix:

  • Components: HWButton, HWModal
  • Sub-components: HWModal.Title, HWMenu.Item
  • Props: HWButtonProps, HWModalProps
  • Imperative APIs: hwToast.success()

License

MIT

版本与发布记录

@cycomdatasystems/headwindui 共发布 35 个版本,首次发布于 2026/04/21;过去 12 个月发布了 35 个版本。

版本发布日期距今
1.10.0latest2026/11/11今天
1.9.02026/11/064 天前
1.8.02026/11/065 天前
1.7.32026/11/019 天前
1.7.22026/10/2219 天前
1.7.12026/10/2120 天前

关于 @cycomdatasystems/headwindui 的常见问题

@cycomdatasystems/headwindui 是什么?

A React UI component library built with Tailwind CSS, Headless UI, and Motion

如何安装 @cycomdatasystems/headwindui?

在项目目录运行 npm install @cycomdatasystems/headwindui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、motion(>=11)、react-dom(>=18)、tailwindcss(^4.0)、@headlessui/react(^2.0)、@floating-ui/react(^0.27)、@tanstack/react-table(^8.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cycomdatasystems/headwindui 支持 TypeScript 吗?

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

@cycomdatasystems/headwindui 支持 ESM 还是 CommonJS?

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

@cycomdatasystems/headwindui 可以商用吗?

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

@cycomdatasystems/headwindui 的下载量有多少?

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

@cycomdatasystems/headwindui 还在维护吗?

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