atomic-design-fundamentals

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Atomic Design Fundamentals

Atomic Design 基础

Master Brad Frost's Atomic Design methodology (extended with quarks) for building scalable, maintainable component-based user interfaces. This skill covers the core hierarchy, principles, and organization strategies for modern design systems.
掌握Brad Frost提出的Atomic Design方法论(扩展了quarks层级),用于构建可扩展、可维护的基于组件的用户界面。本技能涵盖了现代设计系统的核心层级、原则和组织策略。

Overview

概述

Atomic Design is a methodology for creating design systems inspired by chemistry. Just as atoms combine to form molecules, which combine to form organisms, UI components follow a similar hierarchical structure. We extend this with quarks - the sub-atomic level of design tokens:
  1. Quarks - Design tokens (colors, spacing, typography scales, shadows)
  2. Atoms - Basic building blocks (buttons, inputs, labels)
  3. Molecules - Groups of atoms functioning together (search form, card)
  4. Organisms - Complex UI sections (header, footer, sidebar)
  5. Templates - Page-level layouts without real content
  6. Pages - Templates with real representative content
Atomic Design是一种受化学启发的设计系统创建方法论。就像原子结合形成分子,分子再结合形成有机体一样,UI组件遵循类似的层级结构。我们将其扩展了quarks——设计令牌的亚原子级别:
  1. Quarks - 设计令牌(颜色、间距、排版比例、阴影)
  2. Atoms - 基础构建块(按钮、输入框、标签)
  3. Molecules - 协同工作的原子组(搜索表单、卡片)
  4. Organisms - 复杂UI区域(页眉、页脚、侧边栏)
  5. Templates - 无实际内容的页面级布局
  6. Pages - 填充了真实代表性内容的模板

The Six Stages

六个层级

0. Quarks

0. Quarks

The sub-atomic building blocks - design tokens and primitive values that atoms consume. Quarks are not UI components themselves; they are the raw values that define your design language.
Examples:
  • Color tokens (primary-500, neutral-100)
  • Spacing scales (4px, 8px, 16px)
  • Typography tokens (font sizes, weights, line heights)
  • Border radii
  • Shadow definitions
  • Animation durations and easing functions
  • Breakpoints
Characteristics:
  • Pure values, not visual components
  • Cannot import from any other level
  • Define the design language
  • Enable theming and consistency
  • Single source of truth for design decisions
亚原子级构建块——原子所使用的设计令牌和原始值。Quarks本身不是UI组件,而是定义设计语言的原始值。
示例:
  • 颜色令牌(primary-500、neutral-100)
  • 间距比例(4px、8px、16px)
  • 排版令牌(字号、字重、行高)
  • 边框圆角
  • 阴影定义
  • 动画时长与缓动函数
  • 断点
特性:
  • 纯值,非可视化组件
  • 无法从任何其他层级导入
  • 定义设计语言
  • 支持主题化与一致性
  • 设计决策的单一可信来源

1. Atoms

1. Atoms

The smallest functional UI units of your interface. Atoms consume quarks for styling but cannot be broken down further without losing meaning.
Examples:
  • Buttons
  • Input fields
  • Labels
  • Icons
  • Typography elements (headings, paragraphs)
  • Color swatches
  • Avatars
Characteristics:
  • Self-contained and independent
  • No business logic
  • Highly reusable
  • Accept styling props
  • Framework-agnostic when possible
界面中最小的功能UI单元。Atoms使用quarks进行样式设置,但无法再拆分而不失去意义。
示例:
  • 按钮
  • 输入框
  • 标签
  • 图标
  • 排版元素(标题、段落)
  • 色板
  • 头像
特性:
  • 独立且自包含
  • 无业务逻辑
  • 高度可复用
  • 接受样式属性
  • 尽可能与框架无关

2. Molecules

2. Molecules

Combinations of atoms working together as a unit. Molecules have a single responsibility but are composed of multiple atoms.
Examples:
  • Search form (input + button)
  • Form field (label + input + error message)
  • Media object (avatar + text)
  • Card header (icon + title + action button)
  • Navigation link (icon + text)
Characteristics:
  • Composed of atoms only
  • Single purpose or function
  • Reusable across contexts
  • May have minimal internal state
协同工作的原子组合单元。Molecules具有单一职责,但由多个原子组成。
示例:
  • 搜索表单(输入框 + 按钮)
  • 表单字段(标签 + 输入框 + 错误提示)
  • 媒体对象(头像 + 文本)
  • 卡片头部(图标 + 标题 + 操作按钮)
  • 导航链接(图标 + 文本)
特性:
  • 仅由原子组成
  • 单一用途或功能
  • 可跨上下文复用
  • 可能包含最小内部状态

3. Organisms

3. Organisms

Complex, standalone sections of an interface. Organisms represent distinct sections that could exist independently.
Examples:
  • Header (logo + navigation + user menu)
  • Footer (links + social icons + copyright)
  • Product card (image + title + price + add to cart)
  • Comment section (avatar + content + actions)
  • Sidebar navigation
Characteristics:
  • Composed of molecules and atoms
  • Represent distinct UI sections
  • May contain business logic
  • Context-specific but reusable
界面中复杂的独立区域。Organisms代表可独立存在的不同区域。
示例:
  • 页眉(Logo + 导航 + 用户菜单)
  • 页脚(链接 + 社交图标 + 版权信息)
  • 产品卡片(图片 + 标题 + 价格 + 加入购物车)
  • 评论区(头像 + 内容 + 操作按钮)
  • 侧边栏导航
特性:
  • 由分子和原子组成
  • 代表不同的UI区域
  • 可能包含业务逻辑
  • 特定上下文但可复用

4. Templates

4. Templates

Page-level layouts that define content structure without actual content. Templates show the skeletal structure of a page.
Examples:
  • Blog post template (header + content area + sidebar + footer)
  • Dashboard layout (navigation + main content + widgets)
  • Product page layout (gallery + details + related products)
  • Landing page structure
Characteristics:
  • Composed of organisms
  • Define page structure
  • Use placeholder content
  • Establish content hierarchy
定义内容结构但无实际内容的页面级布局。Templates展示页面的框架结构。
示例:
  • 博客文章模板(页眉 + 内容区域 + 侧边栏 + 页脚)
  • 仪表板布局(导航 + 主内容 + 小组件)
  • 产品页面布局(画廊 + 详情 + 相关产品)
  • 着陆页结构
特性:
  • 由有机体组成
  • 定义页面结构
  • 使用占位符内容
  • 建立内容层级

5. Pages

5. Pages

Specific instances of templates with real, representative content. Pages are what users actually see and interact with.
Examples:
  • Homepage with actual hero content
  • Product detail with real product data
  • User profile with actual user information
  • Blog post with real article content
Characteristics:
  • Templates filled with real content
  • Represent actual user experience
  • Used for testing and validation
  • May reveal design issues
填充了真实代表性内容的模板实例。Pages是用户实际看到并交互的内容。
示例:
  • 包含真实首屏内容的首页
  • 包含真实产品数据的产品详情页
  • 包含真实用户信息的用户资料页
  • 包含真实文章内容的博客文章
特性:
  • 填充了真实内容的模板
  • 代表实际用户体验
  • 用于测试与验证
  • 可能暴露设计问题

Directory Structure

目录结构

Standard Structure

标准结构

text
src/
  quarks/                    # Design tokens
    index.ts
    colors.ts
    spacing.ts
    typography.ts
    shadows.ts
    borders.ts
  components/
    atoms/
      Button/
        Button.tsx
        Button.test.tsx
        Button.stories.tsx
        index.ts
      Input/
      Label/
      Icon/
    molecules/
      SearchForm/
      FormField/
      Card/
    organisms/
      Header/
      Footer/
      ProductCard/
    templates/
      MainLayout/
      DashboardLayout/
    pages/
      HomePage/
      ProductPage/
text
src/
  quarks/                    # Design tokens
    index.ts
    colors.ts
    spacing.ts
    typography.ts
    shadows.ts
    borders.ts
  components/
    atoms/
      Button/
        Button.tsx
        Button.test.tsx
        Button.stories.tsx
        index.ts
      Input/
      Label/
      Icon/
    molecules/
      SearchForm/
      FormField/
      Card/
    organisms/
      Header/
      Footer/
      ProductCard/
    templates/
      MainLayout/
      DashboardLayout/
    pages/
      HomePage/
      ProductPage/

Alternative Flat Structure

可选扁平化结构

text
src/
  quarks/
    colors.ts
    spacing.ts
    typography.ts
  components/
    atoms/
      Button.tsx
      Input.tsx
      Label.tsx
    molecules/
      SearchForm.tsx
      FormField.tsx
    organisms/
      Header.tsx
      Footer.tsx
    templates/
      MainLayout.tsx
    pages/
      HomePage.tsx
text
src/
  quarks/
    colors.ts
    spacing.ts
    typography.ts
  components/
    atoms/
      Button.tsx
      Input.tsx
      Label.tsx
    molecules/
      SearchForm.tsx
      FormField.tsx
    organisms/
      Header.tsx
      Footer.tsx
    templates/
      MainLayout.tsx
    pages/
      HomePage.tsx

Feature-Based Hybrid

基于功能的混合结构

text
src/
  quarks/                    # Shared design tokens
    index.ts
    colors.ts
    spacing.ts
  features/
    products/
      components/
        atoms/
        molecules/
        organisms/
      templates/
      pages/
    checkout/
      components/
        atoms/
        molecules/
        organisms/
  shared/
    components/
      atoms/
      molecules/
text
src/
  quarks/                    # Shared design tokens
    index.ts
    colors.ts
    spacing.ts
  features/
    products/
      components/
        atoms/
        molecules/
        organisms/
      templates/
      pages/
    checkout/
      components/
        atoms/
        molecules/
        organisms/
  shared/
    components/
      atoms/
      molecules/

Component Naming Conventions

组件命名规范

File Naming

文件命名

text
undefined
text
undefined

PascalCase for component files

组件文件使用大驼峰式(PascalCase)

Button.tsx SearchForm.tsx ProductCard.tsx
Button.tsx SearchForm.tsx ProductCard.tsx

Index files for clean imports

索引文件用于简洁导入

index.ts
index.ts

Test files

测试文件

Button.test.tsx Button.spec.tsx
Button.test.tsx Button.spec.tsx

Story files (Storybook)

Storybook故事文件

Button.stories.tsx
undefined
Button.stories.tsx
undefined

Component Naming

组件命名

typescript
// Atoms - simple, descriptive names
Button
Input
Label
Avatar
Icon

// Molecules - action or composition-based names
SearchForm
FormField
MediaObject
NavItem

// Organisms - section or feature-based names
Header
Footer
ProductCard
CommentSection
UserProfile

// Templates - layout-focused names
MainLayout
DashboardLayout
AuthLayout

// Pages - page-specific names
HomePage
ProductDetailPage
CheckoutPage
typescript
// Atoms - 简洁、描述性名称
Button
Input
Label
Avatar
Icon

// Molecules - 基于动作或组合的名称
SearchForm
FormField
MediaObject
NavItem

// Organisms - 基于区域或功能的名称
Header
Footer
ProductCard
CommentSection
UserProfile

// Templates - 聚焦布局的名称
MainLayout
DashboardLayout
AuthLayout

// Pages - 页面特定名称
HomePage
ProductDetailPage
CheckoutPage

Import Patterns

导入模式

Barrel Exports

桶式导出

typescript
// src/components/atoms/index.ts
export { Button } from './Button';
export { Input } from './Input';
export { Label } from './Label';
export { Icon } from './Icon';

// src/components/molecules/index.ts
export { SearchForm } from './SearchForm';
export { FormField } from './FormField';

// src/components/index.ts
export * from './atoms';
export * from './molecules';
export * from './organisms';
typescript
// src/components/atoms/index.ts
export { Button } from './Button';
export { Input } from './Input';
export { Label } from './Label';
export { Icon } from './Icon';

// src/components/molecules/index.ts
export { SearchForm } from './SearchForm';
export { FormField } from './FormField';

// src/components/index.ts
export * from './atoms';
export * from './molecules';
export * from './organisms';

Usage

使用方式

typescript
// Clean imports from barrel files
import { Button, Input, Label } from '@/components/atoms';
import { SearchForm, FormField } from '@/components/molecules';
import { Header, Footer } from '@/components/organisms';

// Or from unified barrel
import { Button, SearchForm, Header } from '@/components';
typescript
// 从桶式文件简洁导入
import { Button, Input, Label } from '@/components/atoms';
import { SearchForm, FormField } from '@/components/molecules';
import { Header, Footer } from '@/components/organisms';

// 或从统一桶式文件导入
import { Button, SearchForm, Header } from '@/components';

Composition Rules

组合规则

Strict Hierarchy

严格层级

text
Quarks     -> Used by: Atoms, Molecules, Organisms, Templates, Pages
Atoms      -> Used by: Molecules, Organisms, Templates, Pages
Molecules  -> Used by: Organisms, Templates, Pages
Organisms  -> Used by: Templates, Pages
Templates  -> Used by: Pages
Pages      -> Not used by other components
text
Quarks     -> 被使用于: Atoms, Molecules, Organisms, Templates, Pages
Atoms      -> 被使用于: Molecules, Organisms, Templates, Pages
Molecules  -> 被使用于: Organisms, Templates, Pages
Organisms  -> 被使用于: Templates, Pages
Templates  -> 被使用于: Pages
Pages      -> 不被其他组件使用

Valid Compositions

有效组合

typescript
// Atom using quarks for styling
import { colors, spacing } from '@/quarks';

const Button = styled.button`
  background: ${colors.primary[500]};  {/* Quark */}
  padding: ${spacing.md};              {/* Quark */}
`;

// Molecule using atoms only
const SearchForm = () => (
  <form>
    <Input placeholder="Search..." />  {/* Atom */}
    <Button>Search</Button>            {/* Atom */}
  </form>
);

// Organism using molecules and atoms
const Header = () => (
  <header>
    <Logo />                           {/* Atom */}
    <Navigation />                     {/* Molecule */}
    <SearchForm />                     {/* Molecule */}
    <UserMenu />                       {/* Molecule */}
  </header>
);

// Template using organisms
const MainLayout = ({ children }) => (
  <div>
    <Header />                         {/* Organism */}
    <main>{children}</main>
    <Footer />                         {/* Organism */}
  </div>
);
typescript
// Atom使用quarks进行样式设置
import { colors, spacing } from '@/quarks';

const Button = styled.button`
  background: ${colors.primary[500]};  {/* Quark */}
  padding: ${spacing.md};              {/* Quark */}
`;

// Molecule仅使用atoms
const SearchForm = () => (
  <form>
    <Input placeholder="Search..." />  {/* Atom */}
    <Button>Search</Button>            {/* Atom */}
  </form>
);

// Organism使用molecules和atoms
const Header = () => (
  <header>
    <Logo />                           {/* Atom */}
    <Navigation />                     {/* Molecule */}
    <SearchForm />                     {/* Molecule */}
    <UserMenu />                       {/* Molecule */}
  </header>
);

// Template使用organisms
const MainLayout = ({ children }) => (
  <div>
    <Header />                         {/* Organism */}
    <main>{children}</main>
    <Footer />                         {/* Organism */}
  </div>
);

Invalid Compositions (Anti-patterns)

无效组合(反模式)

typescript
// BAD: Atom importing from molecule
// atoms/Button.tsx
import { FormField } from '../molecules'; // WRONG!

// BAD: Molecule importing from organism
// molecules/SearchForm.tsx
import { Header } from '../organisms'; // WRONG!

// BAD: Skipping levels without justification
// organisms/Header.tsx
import { MainLayout } from '../templates'; // WRONG!
typescript
// 错误:Atom从molecule导入
// atoms/Button.tsx
import { FormField } from '../molecules'; // 错误!

// 错误:Molecule从organism导入
// molecules/SearchForm.tsx
import { Header } from '../organisms'; // 错误!

// 错误:无理由跳过层级
// organisms/Header.tsx
import { MainLayout } from '../templates'; // 错误!

Design Tokens Integration

设计令牌集成

Token Structure

令牌结构

typescript
// design-tokens/colors.ts
export const colors = {
  primary: {
    50: '#e3f2fd',
    100: '#bbdefb',
    500: '#2196f3',
    900: '#0d47a1',
  },
  neutral: {
    0: '#ffffff',
    100: '#f5f5f5',
    900: '#212121',
  },
};

// design-tokens/spacing.ts
export const spacing = {
  xs: '4px',
  sm: '8px',
  md: '16px',
  lg: '24px',
  xl: '32px',
};

// design-tokens/typography.ts
export const typography = {
  fontFamily: {
    sans: 'Inter, system-ui, sans-serif',
    mono: 'Fira Code, monospace',
  },
  fontSize: {
    xs: '12px',
    sm: '14px',
    base: '16px',
    lg: '18px',
    xl: '24px',
  },
};
typescript
// design-tokens/colors.ts
export const colors = {
  primary: {
    50: '#e3f2fd',
    100: '#bbdefb',
    500: '#2196f3',
    900: '#0d47a1',
  },
  neutral: {
    0: '#ffffff',
    100: '#f5f5f5',
    900: '#212121',
  },
};

// design-tokens/spacing.ts
export const spacing = {
  xs: '4px',
  sm: '8px',
  md: '16px',
  lg: '24px',
  xl: '32px',
};

// design-tokens/typography.ts
export const typography = {
  fontFamily: {
    sans: 'Inter, system-ui, sans-serif',
    mono: 'Fira Code, monospace',
  },
  fontSize: {
    xs: '12px',
    sm: '14px',
    base: '16px',
    lg: '18px',
    xl: '24px',
  },
};

Using Tokens in Atoms

在Atoms中使用令牌

typescript
import { colors, spacing, typography } from '@/design-tokens';

const Button = styled.button`
  background-color: ${colors.primary[500]};
  padding: ${spacing.sm} ${spacing.md};
  font-family: ${typography.fontFamily.sans};
  font-size: ${typography.fontSize.base};
`;
typescript
import { colors, spacing, typography } from '@/design-tokens';

const Button = styled.button`
  background-color: ${colors.primary[500]};
  padding: ${spacing.sm} ${spacing.md};
  font-family: ${typography.fontFamily.sans};
  font-size: ${typography.fontSize.base};
`;

Best Practices

最佳实践

1. Start with Atoms

1. 从Atoms开始构建

Build your design system from the ground up:
typescript
// 1. Define core atoms first
const Button = ({ variant, size, children }) => { ... };
const Input = ({ type, placeholder }) => { ... };
const Label = ({ htmlFor, children }) => { ... };

// 2. Compose into molecules
const FormField = ({ label, ...inputProps }) => (
  <div>
    <Label>{label}</Label>
    <Input {...inputProps} />
  </div>
);

// 3. Build organisms from molecules
const LoginForm = () => (
  <form>
    <FormField label="Email" type="email" />
    <FormField label="Password" type="password" />
    <Button>Login</Button>
  </form>
);
自下而上构建设计系统:
typescript
// 1. 先定义核心atoms
const Button = ({ variant, size, children }) => { ... };
const Input = ({ type, placeholder }) => { ... };
const Label = ({ htmlFor, children }) => { ... };

// 2. 组合为molecules
const FormField = ({ label, ...inputProps }) => (
  <div>
    <Label>{label}</Label>
    <Input {...inputProps} />
  </div>
);

// 3. 用molecules构建organisms
const LoginForm = () => (
  <form>
    <FormField label="Email" type="email" />
    <FormField label="Password" type="password" />
    <Button>Login</Button>
  </form>
);

2. Props Flow Downward

2. 属性向下传递

typescript
// Atoms receive primitive props
interface ButtonProps {
  variant: 'primary' | 'secondary';
  size: 'sm' | 'md' | 'lg';
  disabled?: boolean;
  onClick?: () => void;
  children: React.ReactNode;
}

// Molecules receive atoms' props via spread
interface SearchFormProps {
  onSubmit: (query: string) => void;
  inputProps?: Partial<InputProps>;
  buttonProps?: Partial<ButtonProps>;
}

// Organisms receive domain-specific props
interface HeaderProps {
  user?: User;
  onLogout: () => void;
  navigation: NavItem[];
}
typescript
// Atoms接收原始属性
interface ButtonProps {
  variant: 'primary' | 'secondary';
  size: 'sm' | 'md' | 'lg';
  disabled?: boolean;
  onClick?: () => void;
  children: React.ReactNode;
}

// Molecules通过扩展接收atoms的属性
interface SearchFormProps {
  onSubmit: (query: string) => void;
  inputProps?: Partial<InputProps>;
  buttonProps?: Partial<ButtonProps>;
}

// Organisms接收领域特定属性
interface HeaderProps {
  user?: User;
  onLogout: () => void;
  navigation: NavItem[];
}

3. Avoid Business Logic in Atoms

3. 避免在Atoms中加入业务逻辑

typescript
// BAD: Atom with business logic
const PriceButton = ({ productId }) => {
  const price = useProductPrice(productId); // WRONG!
  return <Button>${price}</Button>;
};

// GOOD: Atom receives processed data
const PriceButton = ({ price, onClick }) => (
  <Button onClick={onClick}>${price}</Button>
);

// Business logic lives in organisms or higher
const ProductCard = ({ productId }) => {
  const { price } = useProduct(productId);
  return <PriceButton price={price} onClick={handleBuy} />;
};
typescript
// 错误:Atom包含业务逻辑
const PriceButton = ({ productId }) => {
  const price = useProductPrice(productId); // 错误!
  return <Button>${price}</Button>;
};

// 正确:Atom接收处理后的数据
const PriceButton = ({ price, onClick }) => (
  <Button onClick={onClick}>${price}</Button>
);

// 业务逻辑存在于organisms或更高层级
const ProductCard = ({ productId }) => {
  const { price } = useProduct(productId);
  return <PriceButton price={price} onClick={handleBuy} />;
};

4. Document Component Purpose

4. 记录组件用途

typescript
/**
 * Button - Atomic component for user actions
 *
 * @level Atom
 * @example
 * <Button variant="primary" size="md">Click me</Button>
 */
export const Button: React.FC<ButtonProps> = ({ ... }) => { ... };

/**
 * SearchForm - Search input with submit button
 *
 * @level Molecule
 * @composition Input, Button
 * @example
 * <SearchForm onSubmit={(query) => search(query)} />
 */
export const SearchForm: React.FC<SearchFormProps> = ({ ... }) => { ... };
typescript
/**
 * Button - 用于用户操作的原子组件
 *
 * @level Atom
 * @example
 * <Button variant="primary" size="md">Click me</Button>
 */
export const Button: React.FC<ButtonProps> = ({ ... }) => { ... };

/**
 * SearchForm - 带提交按钮的搜索输入框
 *
 * @level Molecule
 * @composition Input, Button
 * @example
 * <SearchForm onSubmit={(query) => search(query)} />
 */
export const SearchForm: React.FC<SearchFormProps> = ({ ... }) => { ... };

Common Pitfalls

常见陷阱

1. Over-Atomization

1. 过度原子化

typescript
// BAD: Too granular - unnecessary atoms
const ButtonText = ({ children }) => <span>{children}</span>;
const ButtonContainer = ({ children }) => <div>{children}</div>;

// GOOD: Appropriate granularity
const Button = ({ children }) => (
  <button className="btn">{children}</button>
);
typescript
// 错误:过于细分 - 不必要的atoms
const ButtonText = ({ children }) => <span>{children}</span>;
const ButtonContainer = ({ children }) => <div>{children}</div>;

// 正确:合适的粒度
const Button = ({ children }) => (
  <button className="btn">{children}</button>
);

2. Under-Atomization

2. 原子化不足

typescript
// BAD: Too much in one component
const MegaForm = () => (
  <form>
    <div><label>Name</label><input /></div>
    <div><label>Email</label><input /></div>
    <div><label>Message</label><textarea /></div>
    <button>Submit</button>
  </form>
);

// GOOD: Properly decomposed
const ContactForm = () => (
  <form>
    <FormField label="Name" type="text" />
    <FormField label="Email" type="email" />
    <TextAreaField label="Message" />
    <Button type="submit">Submit</Button>
  </form>
);
typescript
// 错误:一个组件包含过多内容
const MegaForm = () => (
  <form>
    <div><label>Name</label><input /></div>
    <div><label>Email</label><input /></div>
    <div><label>Message</label><textarea /></div>
    <button>Submit</button>
  </form>
);

// 正确:合理拆分
const ContactForm = () => (
  <form>
    <FormField label="Name" type="text" />
    <FormField label="Email" type="email" />
    <TextAreaField label="Message" />
    <Button type="submit">Submit</Button>
  </form>
);

3. Circular Dependencies

3. 循环依赖

typescript
// BAD: Atoms importing from molecules
// atoms/Icon.tsx
import { IconButton } from '../molecules'; // Creates circular dep!

// GOOD: Keep imports flowing downward
// molecules/IconButton.tsx
import { Icon } from '../atoms';
import { Button } from '../atoms';
typescript
// 错误:Atoms从molecules导入
// atoms/Icon.tsx
import { IconButton } from '../molecules'; // 造成循环依赖!

// 正确:保持导入向下流动
// molecules/IconButton.tsx
import { Icon } from '../atoms';
import { Button } from '../atoms';

4. Inconsistent Naming

4. 命名不一致

typescript
// BAD: Inconsistent naming patterns
atoms/btn.tsx
atoms/InputField.tsx
atoms/text-label.tsx

// GOOD: Consistent PascalCase
atoms/Button.tsx
atoms/Input.tsx
atoms/Label.tsx
typescript
// 错误:命名模式不一致
atoms/btn.tsx
atoms/InputField.tsx
atoms/text-label.tsx

// 正确:统一使用大驼峰式
atoms/Button.tsx
atoms/Input.tsx
atoms/Label.tsx

When to Use This Skill

何时使用本技能

  • Setting up a new design system
  • Organizing an existing component library
  • Onboarding team members to atomic design
  • Auditing component structure
  • Planning component architecture
  • Creating documentation for design systems
  • Refactoring monolithic components
  • 搭建新的设计系统
  • 组织现有组件库
  • 团队成员Atomic Design入门培训
  • 组件结构审计
  • 组件架构规划
  • 设计系统文档创建
  • 重构单体组件

Related Skills

相关技能

  • atomic-design-quarks
    - Design tokens and primitive values
  • atomic-design-atoms
    - Creating atomic-level components
  • atomic-design-molecules
    - Composing atoms into molecules
  • atomic-design-organisms
    - Building complex organisms
  • atomic-design-templates
    - Page layouts without content
  • atomic-design-integration
    - Framework-specific implementation
  • atomic-design-quarks
    - 设计令牌与原始值
  • atomic-design-atoms
    - 创建原子级组件
  • atomic-design-molecules
    - 将原子组合为分子
  • atomic-design-organisms
    - 构建复杂有机体
  • atomic-design-templates
    - 无内容的页面布局
  • atomic-design-integration
    - 框架特定实现

Resources

资源

Documentation

文档

Books

书籍

  • "Atomic Design" by Brad Frost
  • "Design Systems" by Alla Kholmatova
  • 《Atomic Design》作者:Brad Frost
  • 《Design Systems》作者:Alla Kholmatova

Tools

工具