# 设计系统指南 **生成时间:** 2026-03-08 ## 概述 基于 CVA 的可复用 UI 组件库,与业务组件分离。 ## 组件分类 | 类别 | 路径 | 组件 | |------|------|------| | 基础 | `base/` | button, input, card, checkbox, radio, switch, select, textarea, range | | 反馈 | `feedback/` | alert, progress, skeleton, toast | | 布局 | `layout/` | container, grid, stack (VStack, HStack) | | 覆盖层 | `overlay/` | modal | | 导航 | `navigation/` | tabs | ## CVA 模式 ```tsx import { cva, type VariantProps } from "class-variance-authority"; const buttonVariants = cva("base-styles", { variants: { variant: { primary: "...", secondary: "...", ghost: "..." }, size: { sm: "...", md: "...", lg: "..." }, }, defaultVariants: { variant: "secondary", size: "md" }, }); export type ButtonVariant = VariantProps["variant"]; ``` ## 组件模板 ```tsx "use client"; import { forwardRef } from "react"; import { cn } from "@/design-system/lib/utils"; export const Button = forwardRef( ({ className, variant, size, leftIcon, rightIcon, children, ...props }, ref) => ( ) ); Button.displayName = "Button"; export const PrimaryButton = (props: Omit) =>