moai-domain-uiux

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Quick Reference

快速参考

Core UI/UX Foundation - Enterprise-grade UI/UX foundation integrating design systems (W3C DTCG 2025.10), component architecture (React 19, Vue 3.5), accessibility (WCAG 2.2), icon libraries (200K+ icons), and theming systems.
Unified Capabilities:
  • Design Systems: W3C DTCG 2025.10 tokens, Style Dictionary 4.0, Pencil MCP workflows
  • Component Architecture: Atomic Design, React 19, Vue 3.5, shadcn/ui, Radix UI primitives
  • Accessibility: WCAG 2.2 AA/AAA compliance, keyboard navigation, screen reader optimization
  • Icon Libraries: 10+ ecosystems (Lucide, React Icons 35K+, Tabler 5900+, Iconify 200K+)
  • Theming: CSS variables, light/dark modes, theme provider, brand customization
When to Use:
  • Building modern UI component libraries with design system foundations
  • Implementing accessible, enterprise-grade user interfaces
  • Setting up design token architecture for multi-platform projects
  • Integrating comprehensive icon systems with optimal bundle sizes
  • Creating customizable theming systems with dark mode support
Module Organization:
  • Components: modules/component-architecture.md (Atomic Design, component patterns, props APIs)
  • Design Systems: modules/design-system-tokens.md (DTCG tokens, Style Dictionary, Pencil MCP)
  • Accessibility: modules/accessibility-wcag.md (WCAG 2.2 compliance, testing, navigation)
  • Icons: modules/icon-libraries.md (10+ libraries, selection guide, performance optimization)
  • Theming: modules/theming-system.md (theme system, CSS variables, brand customization)
  • Web Interface Guidelines: modules/web-interface-guidelines.md (Vercel Labs comprehensive UI/UX compliance)
  • Examples: examples.md (practical implementation examples)
  • Reference: reference.md (external documentation links)

核心UI/UX基础 - 企业级UI/UX基础,整合设计系统(W3C DTCG 2025.10)、组件架构(React 19、Vue 3.5)、可访问性(WCAG 2.2)、图标库(20万+图标)及主题系统。
统一能力:
  • 设计系统:W3C DTCG 2025.10令牌、Style Dictionary 4.0、Pencil MCP工作流
  • 组件架构:原子设计、React 19、Vue 3.5、shadcn/ui、Radix UI基础组件
  • 可访问性:WCAG 2.2 AA/AAA合规、键盘导航、屏幕阅读器优化
  • 图标库:10+生态系统(Lucide、React Icons 3.5万+、Tabler 5900+、Iconify 20万+)
  • 主题设计:CSS变量、亮色/暗色模式、主题提供器、品牌定制
适用场景:
  • 基于设计系统基础构建现代UI组件库
  • 实现符合可访问性要求的企业级用户界面
  • 为多平台项目搭建设计令牌架构
  • 集成全面的图标系统并优化包体积
  • 创建支持暗色模式的可定制主题系统
模块组织:
  • 组件:modules/component-architecture.md(原子设计、组件模式、Props API)
  • 设计系统:modules/design-system-tokens.md(DTCG令牌、Style Dictionary、Pencil MCP)
  • 可访问性:modules/accessibility-wcag.md(WCAG 2.2合规性、测试、导航)
  • 图标:modules/icon-libraries.md(10+库、选择指南、性能优化)
  • 主题:modules/theming-system.md(主题系统、CSS变量、品牌定制)
  • Web界面指南:modules/web-interface-guidelines.md(Vercel Labs全面UI/UX合规指南)
  • 示例:examples.md(实际实现示例)
  • 参考:reference.md(外部文档链接)

Implementation Guide

实施指南

Foundation Stack

基础技术栈

Core Technologies:
  • React 19 with Server Components and Concurrent Rendering
  • TypeScript 5.5 with full type safety and improved inference
  • Tailwind CSS 3.4 with JIT compilation, CSS variables, and dark mode
  • Radix UI for unstyled accessible primitives
  • W3C DTCG 2025.10 for design token specification
  • Style Dictionary 4.0 for token transformation
  • Pencil MCP for design-to-code automation
  • Storybook 8.x for component documentation
Quick Decision Guide:
For design tokens, use modules/design-system-tokens.md with DTCG 2025.10 and Style Dictionary 4.0.
For component patterns, use modules/component-architecture.md with Atomic Design, React 19, and shadcn/ui.
For accessibility, use modules/accessibility-wcag.md with WCAG 2.2, jest-axe, and keyboard navigation.
For icons, use modules/icon-libraries.md with Lucide, React Icons, Tabler, and Iconify.
For theming, use modules/theming-system.md with CSS variables and Theme Provider.
For practical examples, use examples.md with React and Vue implementations.

核心技术:
  • 支持Server Components和Concurrent Rendering的React 19
  • 具备完整类型安全和增强推断能力的TypeScript 5.5
  • 支持JIT编译、CSS变量和暗色模式的Tailwind CSS 3.4
  • 用于无样式可访问基础组件的Radix UI
  • 用于设计令牌规范的W3C DTCG 2025.10
  • 用于令牌转换的Style Dictionary 4.0
  • 用于设计转代码自动化的Pencil MCP
  • 用于组件文档的Storybook 8.x
快速决策指南:
设计令牌相关:使用modules/design-system-tokens.md,基于DTCG 2025.10和Style Dictionary 4.0。
组件模式相关:使用modules/component-architecture.md,基于原子设计、React 19和shadcn/ui。
可访问性相关:使用modules/accessibility-wcag.md,基于WCAG 2.2、jest-axe和键盘导航。
图标相关:使用modules/icon-libraries.md,基于Lucide、React Icons、Tabler和Iconify。
主题相关:使用modules/theming-system.md,基于CSS变量和Theme Provider。
实际示例相关:使用examples.md,包含React和Vue实现。

Quick Start Workflows

快速开始工作流

Design System Setup

设计系统搭建

Step 1: Initialize design tokens by creating a JSON file with DTCG schema URL. Define color tokens with type color and primary 500 value. Define spacing tokens with type dimension and md value of 1rem.
Step 2: Transform tokens with Style Dictionary by installing the package and running the build command.
Step 3: Integrate with components by importing colors and spacing from the tokens directory.
See modules/design-system-tokens.md for complete token architecture.
步骤1:通过创建包含DTCG schema URL的JSON文件初始化设计令牌。定义类型为color、primary 500值的颜色令牌,以及类型为dimension、md值为1rem的间距令牌。
步骤2:安装Style Dictionary包并运行构建命令,转换令牌。
步骤3:通过从令牌目录导入颜色和间距,将其与组件集成。
完整令牌架构请查看modules/design-system-tokens.md。

Component Library Setup

组件库搭建

Step 1: Initialize shadcn/ui by running the init command, then add button, form, and dialog components.
Step 2: Set up Atomic Design structure with atoms directory for Button, Input, and Label components, molecules directory for FormGroup and Card components, and organisms directory for DataTable and Modal components.
Step 3: Implement with accessibility by adding aria-label attributes to interactive elements.
See modules/component-architecture.md for patterns and examples.
步骤1:运行init命令初始化shadcn/ui,然后添加按钮、表单和对话框组件。
步骤2:搭建原子设计结构,atoms目录存放Button、Input和Label组件,molecules目录存放FormGroup和Card组件,organisms目录存放DataTable和Modal组件。
步骤3:通过为交互元素添加aria-label属性实现可访问性。
模式和示例请查看modules/component-architecture.md。

Icon System Integration

图标系统集成

Step 1: Choose icon library based on needs. Install lucide-react for general purpose, iconify/react for maximum variety, or tabler/icons-react for dashboard optimization.
Step 2: Implement type-safe icons by importing specific icons and applying className for sizing and color.
See modules/icon-libraries.md for library comparison and optimization.
步骤1:根据需求选择图标库。通用场景安装lucide-react,追求最大多样性安装iconify/react,仪表盘优化安装tabler/icons-react。
步骤2:通过导入特定图标并应用className设置尺寸和颜色,实现类型安全的图标。
库对比和优化请查看modules/icon-libraries.md。

Theme System Setup

主题系统搭建

Step 1: Configure CSS variables in root selector for primary and background colors. Define dark class with inverted values for dark mode.
Step 2: Implement Theme Provider by wrapping the application with attribute set to class and defaultTheme set to system.
See modules/theming-system.md for complete theme system.

步骤1:在根选择器中配置primary和背景色的CSS变量。定义dark类并设置反转值以支持暗色模式。
步骤2:通过用attribute设为class、defaultTheme设为system的Theme Provider包裹应用,实现主题提供器。
完整主题系统请查看modules/theming-system.md。

Key Principles

核心原则

Design Token First:
  • Single source of truth for design decisions
  • Semantic naming using color.primary.500 format rather than blue-500
  • Multi-theme support for light and dark modes
  • Platform-agnostic transformation
Accessibility by Default:
  • WCAG 2.2 AA minimum with 4.5:1 text contrast
  • Keyboard navigation for all interactive elements
  • ARIA attributes for screen readers
  • Focus management and visible indicators
Component Composition:
  • Atomic Design hierarchy from Atoms to Molecules to Organisms
  • Props API for reusability
  • Variant-based styling rather than separate components
  • Type-safe with TypeScript
Performance Optimization:
  • Tree-shaking for icons by importing specific icons rather than all
  • Lazy loading for large components
  • React.memo for expensive renders
  • Bundle size monitoring

设计令牌优先:
  • 设计决策的单一事实来源
  • 使用color.primary.500格式的语义化命名,而非blue-500
  • 支持亮色和暗色的多主题
  • 与平台无关的转换
默认可访问性:
  • 最低符合WCAG 2.2 AA,文本对比度4.5:1
  • 所有交互元素支持键盘导航
  • 为屏幕阅读器添加ARIA属性
  • 焦点管理和可见指示器
组件组合:
  • 从原子到分子再到有机体的原子设计层级
  • 基于Props API的可复用性
  • 基于变体的样式而非独立组件
  • 用TypeScript实现类型安全
性能优化:
  • 通过导入特定图标而非全部图标实现图标树摇优化
  • 大型组件懒加载
  • 对开销大的渲染使用React.memo
  • 包体积监控

Best Practices

最佳实践

Required Practices:
Use design tokens exclusively for all color, spacing, and typography values. Design tokens provide a single source of truth, enabling consistent theming, multi-platform support, and scalable design systems. Hardcoded values create maintenance debt and break theme switching.
Include ARIA labels on all icon-only interactive elements. Screen readers cannot interpret visual icons without text alternatives. Missing ARIA labels violate WCAG 2.2 AA compliance.
Import icons individually rather than using namespace imports. Namespace imports bundle entire libraries, defeating tree-shaking optimization. Bundle sizes increase by 500KB-2MB per icon library.
Test all components in both light and dark modes. Theme switching affects color contrast, readability, and accessibility compliance.
Implement keyboard navigation for all interactive components. Keyboard-only users require Tab, Enter, Escape, and Arrow key support.
Provide visible focus indicators for all focusable elements. Focus indicators communicate current keyboard position for navigation and accessibility.
Use Tailwind utility classes instead of inline styles. Tailwind provides consistent spacing scale, responsive design, and automatic purging for optimal bundle sizes.
Include loading states for all asynchronous operations. Loading states provide feedback during data fetching, preventing user uncertainty.

强制实践:
所有颜色、间距和排版值仅使用设计令牌。设计令牌提供单一事实来源,实现一致的主题设计、多平台支持和可扩展的设计系统。硬编码值会增加维护成本并破坏主题切换功能。
所有仅含图标的交互元素需添加ARIA标签。屏幕阅读器无法解读无文本替代的视觉图标。缺失ARIA标签违反WCAG 2.2 AA合规要求。
单独导入图标而非使用命名空间导入。命名空间导入会打包整个库,无法实现树摇优化。每个图标库会使包体积增加500KB-2MB。
在亮色和暗色模式下测试所有组件。主题切换会影响颜色对比度、可读性和可访问性合规性。
所有交互组件实现键盘导航。仅使用键盘的用户需要Tab、Enter、Escape和方向键支持。
为所有可聚焦元素提供可见的焦点指示器。焦点指示器为键盘用户传达当前导航位置,保障可访问性。
使用Tailwind工具类而非内联样式。Tailwind提供一致的间距比例、响应式设计和自动清除未使用样式的功能,优化包体积。
所有异步操作需包含加载状态。加载状态在数据获取期间提供反馈,避免用户产生不确定感。

Works Well With

协同适配

Skills:
  • moai-lang-typescript - TypeScript and JavaScript best practices
  • moai-foundation-core - TRUST 5 quality validation
  • moai-library-nextra - Documentation generation
  • moai-library-shadcn - shadcn/ui specialized patterns
Agents:
  • code-frontend - Frontend component implementation
  • design-uiux - Design system architecture
  • mcp-pencil - Pencil MCP design workflows
  • core-quality - Accessibility and quality validation
Commands:
  • /moai:2-run - DDD implementation cycle
  • /moai:3-sync - Documentation generation

技能:
  • moai-lang-typescript - TypeScript和JavaScript最佳实践
  • moai-foundation-core - TRUST 5质量验证
  • moai-library-nextra - 文档生成
  • moai-library-shadcn - shadcn/ui专用模式
智能体:
  • code-frontend - 前端组件实现
  • design-uiux - 设计系统架构
  • mcp-pencil - Pencil MCP设计工作流
  • core-quality - 可访问性和质量验证
命令:
  • /moai:2-run - DDD实施周期
  • /moai:3-sync - 文档生成

Resources

资源

For detailed module documentation, see the modules directory.
For practical code examples, see examples.md.
For external documentation links, see reference.md.
Official Resources:

Last Updated: 2026-01-11 Status: Production Ready Version: 2.0.0
详细模块文档请查看modules目录。
实际代码示例请查看examples.md。
外部文档链接请查看reference.md。
官方资源:

最后更新:2026-01-11 状态:生产就绪 版本:2.0.0