@duyluonganduin/acl-web-components

中文文档
0.0.80发布于 2026/11/05TypeScriptESM + CJS近 30 天下载 3445

A native Web Components library built with Lit and TypeScript for the Anduin design system.

原始使用文档
文档目录15 节
  1. Installation
  2. Setup
  3. 1. Import the components
  4. 2. Import design tokens (required)
  5. Tailwind Integration
  6. Tailwind v3
  7. Tailwind v4
  8. Using token-based utility classes
  9. Components
  10. Framework integration
  11. TypeScript + React — JSX types
  12. Component Reference
  13. Package Exports
  14. Development
  15. Stack

acl-web-components

A native Web Components library built with Lit and TypeScript for the Anduin design system.

Installation

npm i @duyluonganduin/acl-web-components

Setup

1. Import the components

import '@duyluonganduin/acl-web-components'

2. Import design tokens (required)

The tokens file sets all CSS custom properties (--color-*, --text-*, etc.) on :root. It must be imported once at your app root.

@import '@duyluonganduin/acl-web-components/tokens.css';

Or in JS:

import '@duyluonganduin/acl-web-components/tokens.css'

Tailwind Integration

Tailwind v3

Add the preset to extend your Tailwind theme with all design tokens:

// tailwind.config.js
import aclPreset from '@duyluonganduin/acl-web-components/tailwind-preset'

export default {
  presets: [aclPreset],
  content: ['./src/**/*.{html,js,ts,jsx,tsx}'],
}
/* main.css */
@import '@duyluonganduin/acl-web-components/tokens.css';
@tailwind base;
@tailwind components;
@tailwind utilities;

Tailwind v4

Import the CSS theme bridge instead of a config preset:

/* main.css */
@import "tailwindcss";
@import "@duyluonganduin/acl-web-components/tokens.css";
@import "@duyluonganduin/acl-web-components/tailwind-theme.css";

No tailwind.config.js changes needed.

Using token-based utility classes

Once set up, you can use token values directly as Tailwind classes:

<p class="text-13 font-medium text-primary-4 leading-20">Heading</p>
<div class="bg-gray-1 rounded-lg shadow-2 p-16 gap-8 flex">...</div>
<span class="text-danger-4 font-semibold">Error message</span>

Components

Use components directly in HTML — they work in any framework since they are standard custom elements.

<anduin-button appearance="filled" variant="primary">Save</anduin-button>
<anduin-input placeholder="Search..."></anduin-input>
<anduin-spinner size="small"></anduin-spinner>

Framework integration

React:

import '@duyluonganduin/acl-web-components'
import '@duyluonganduin/acl-web-components/tokens.css'

export default function App() {
  return (
    <div>
      <anduin-button appearance="filled" variant="primary">Click me</anduin-button>
      <anduin-input placeholder="Enter text..."></anduin-input>
    </div>
  )
}

Vue:

<script setup>
import '@duyluonganduin/acl-web-components'
import '@duyluonganduin/acl-web-components/tokens.css'
</script>

<template>
  <anduin-button appearance="filled" variant="primary">Click me</anduin-button>
  <anduin-input placeholder="Enter text..."></anduin-input>
</template>

TypeScript + React — JSX types

The package ships dist/react.d.ts which augments React.JSX.IntrinsicElements so TypeScript accepts all anduin-* elements in .tsx files without errors.

Enable it in one of two ways:

Option A — tsconfig.json (recommended, applies project-wide):

{
  "compilerOptions": {
    "types": ["@duyluonganduin/acl-web-components/react"]
  }
}

Option B — reference directive (per-file or in a global .d.ts):

/// <reference types="@duyluonganduin/acl-web-components/react" />

Once enabled, all component props are typed:

<anduin-button appearance="filled" variant="primary" disabled>
  Save
</anduin-button>

<anduin-input value={query} placeholder="Search..." status="valid"></anduin-input>

Component Reference

ComponentTagKey Attributes
Badge<anduin-badge>variant
Badge Count<anduin-badge-count>variant, count
Button<anduin-button>appearance, variant (default: gray0), size, disabled, loading, href, pill, full-width, start-icon, end-icon
Callout<anduin-callout>variant
Checkbox<anduin-checkbox>checked, disabled, indeterminate, readonly, inputid
Divider<anduin-divider>direction
Dot<anduin-dot>variant
Field<anduin-field>orientation
Field Label<anduin-field-label>htmlfor, required
Field Description<anduin-field-description>—
Field Error<anduin-field-error>—
Field Group<anduin-field-group>—
Icon<anduin-icon>name, size (12 small · 16 default · 20 · 24 large)
Input<anduin-input>value, size, disabled, readonly, placeholder, inputid, status
Inline Edit<anduin-inline-edit>value, placeholder, size (small/medium), mode, disabled, click-to-edit, edit-label; .validate property; edit()
Loading State<anduin-loading-state>height
Progress<anduin-progress>percent, height
Skeleton<anduin-skeleton>effect, shape, height, width, duration, font-size
Spinner<anduin-spinner>size, percent
AI Spinner<anduin-ai-spinner>state (loading/still), size (px, default 20)
Menu<anduin-menu>placement, open
Menu Item<anduin-menu-item>icon, variant, disabled
Popover<anduin-popover>placement, open
Tabs<anduin-tabs>default-value, value, fill
Tab List<anduin-tabs-list>alignment
Tab Trigger<anduin-tab-trigger>value, start-icon, disabled, show-badge, badge-count
Tab Content<anduin-tab-content>value
Tag<anduin-tag>variant, icon, disabled
Tag Close<anduin-tag-close>—
Textarea<anduin-textarea>value, disabled, readonly, placeholder, inputid, rows, status
Toggle Group<anduin-toggle-group>mode (single/multiple), default-value, value, size, variant, gap
Toggle Group Item<anduin-toggle-group-item>value, start-icon, disabled
Tooltip<anduin-tooltip>placement, disabled
Tooltip Trigger<anduin-tooltip-trigger>—
Tooltip Content<anduin-tooltip-content>—
Well<anduin-well>variant
Well Close<anduin-well-close>—

Package Exports

Import pathContents
@duyluonganduin/acl-web-componentsAll component classes (auto-registers custom elements)
@duyluonganduin/acl-web-components/tokens.cssCSS custom properties for all design tokens
@duyluonganduin/acl-web-components/tailwind-presetTailwind v3 preset
@duyluonganduin/acl-web-components/tailwind-theme.cssTailwind v4 @theme inline bridge
@duyluonganduin/acl-web-components/reactReact JSX types (IntrinsicElements for all anduin-* elements)

Development

npm install
npm run storybook        # Component dev server → http://localhost:6006
npm run build            # Type-check + Vite build → dist/
npm run build-storybook  # Static Storybook export

Stack

  • Lit — Web Components base library
  • Vite — Build tool (library mode)
  • Storybook — Component development & documentation
  • TypeScript

版本与发布记录

@duyluonganduin/acl-web-components 共发布 78 个版本,首次发布于 2026/03/24;过去 12 个月发布了 78 个版本。

版本发布日期距今
0.0.80latest2026/11/058 天前
0.0.792026/11/058 天前
0.0.782026/11/049 天前
0.0.772026/11/049 天前
0.0.762026/11/0310 天前
0.0.752026/11/0310 天前

关于 @duyluonganduin/acl-web-components 的常见问题

@duyluonganduin/acl-web-components 是什么?

A native Web Components library built with Lit and TypeScript for the Anduin design system.

如何安装 @duyluonganduin/acl-web-components?

在项目目录运行 npm install @duyluonganduin/acl-web-components,或使用 pnpm add / yarn add / bun add。

@duyluonganduin/acl-web-components 支持 TypeScript 吗?

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

@duyluonganduin/acl-web-components 支持 ESM 还是 CommonJS?

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

@duyluonganduin/acl-web-components 可以商用吗?

@duyluonganduin/acl-web-components 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@duyluonganduin/acl-web-components 的下载量有多少?

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

@duyluonganduin/acl-web-components 还在维护吗?

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