Ant Design Skill

👤 felipeoff 📦 v0.1.0 ⭐ 4.4 ⬇️ 2.8K 下载
💻 开发编程 免费

📖 技能介绍


name: ant_design_skill description: Front-end design skill for building React UIs with Ant Design (antd): component patterns, layout, forms, tables, and theming/tokens via ConfigProvider.


Ant Design (React) — Practical Front-end Design Skill

Use this skill when you are building a React UI with Ant Design (antd) and want consistent, non-ugly screens fast.

When to use

  • The project uses React + Ant Design
  • You need to design/implement pages with: Layout, Menu, Form, Table, Modal, Drawer, Steps, Tabs, Pagination
  • You need to implement theme tokens (colors, radius, typography, spacing)
  • You want predictable UI patterns (CRUD screens, dashboards, settings pages)

Default workflow (do this order)

1) Confirm stack: React + antd version (v5+ assumed). 2) Choose page pattern: - CRUD list (Table) + filters (Form) + actions (Modal/Drawer) - Wizard (Steps) - Settings (Form + Cards) - Dashboard (Grid + Cards + Charts) 3) Build layout skeleton first: - Layout + Sider + Header + Content - Navigation with Menu 4) Build the main interaction component: - Forms: Form, Form.Item, Input, Select, DatePicker, Switch - Tables: Table + column definitions + row actions 5) Add feedback loop: - message, notification, Modal.confirm 6) Apply theming/tokens via ConfigProvider (global) and component-level overrides. 7) Verify: - Empty states - Loading states - Error states - Mobile responsiveness (at least: 360px layout sanity)

Component patterns (copy/paste mental models)

Layout

  • Use Layout with Sider (collapsible), Header for top actions, Content scroll.
  • Put page title + primary CTA in a Flex (or Space) row.

Forms

  • Keep forms vertical; align labels consistently.
  • Use Form + Form.Item rules for validation; avoid custom validation unless necessary.
  • Use Form.useForm() and form.setFieldsValue() for edit flows.

Tables (CRUD)

  • Columns:
  • left: identifier/name
  • middle: important attributes
  • right: actions (Edit/Delete)
  • Use rowKey always.
  • Use server-side pagination for real apps.

Modals/Drawers

  • Modal for short forms.
  • Drawer for longer forms or when you want context kept.

Theming / Tokens (AntD v5)

Ant Design v5 uses Design Tokens and CSS-in-JS.

Global theme

Wrap your app in ConfigProvider:

import { ConfigProvider, theme } from 'antd';

export function AppProviders({ children }: { children: React.ReactNode }) {
  return (
    <ConfigProvider
      theme={{
        algorithm: theme.defaultAlgorithm,
        token: {
          colorPrimary: '#1677ff',
          borderRadius: 10,
          fontSize: 14,
        },
        components: {
          Button: { controlHeight: 40 },
          Layout: { headerBg: '#ffffff' },
        },
      }}
    >
      {children}
    </ConfigProvider>
  );
}

Dark mode

Use theme.darkAlgorithm and keep tokens consistent:

const isDark = true;

<ConfigProvider
  theme={{
    algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm,
    token: { colorPrimary: '#7c3aed' },
  }}
/>

Component-level overrides

Use components.<ComponentName> for specific tweaks (Button, Input, Table, etc.).

References

  • Read README.md for the full “how-to” (setup + patterns + examples).
  • Use protocols/ when you want LLM-first contracts (describe UIs as data, then generate code deterministically).
  • Read references/tokens.md for a tokens cookbook.
  • Read references/components.md for practical page recipes (CRUD, Settings, Wizard).
  • Use examples/ when you want ready-to-copy AntD screens.

    7w4.net收录了海量优质技能插件。

  • Use starter/ when you need a runnable Vite + React + AntD skeleton.

Guardrails

  • Assume Ant Design v5+ (tokens). If project is v4 (Less variables), stop and ask.
  • Prefer built-in components and patterns over custom CSS.
  • Avoid over-theming: set a small set of tokens and only override components when needed.

🤖 AI 评测

这个技能库质量不错,提供了完整的 React + Ant Design UI 开发指南,涵盖常用的 CRUD 页面、表单、表格、主题配置等场景,文档清晰易读。优点是内容全面、结构规范,有可直接使用的代码示例和设计规则。不足之处是示例代码存在语言混用问题,且缺少测试相关指导,部分协议文档可以更详细。整体而言,这是一个实用且可靠的开发技能资源。

📊 多维度评分

适应性4.3
规范性4.4
有效性4.6
可靠性4.1
可信度4.5

📁 包含文件 (36 个)

📄 README.md 4.9 KB
📄 SKILL.md 3.9 KB
📄 _meta.json 135 B
📄 examples/README.md 578 B
📄 examples/crud-users/README.md 626 B
📄 examples/crud-users/UsersPage.tsx 8.4 KB
📄 examples/crud-users/mockServer.ts 2 KB
📄 examples/crud-users/types.ts 519 B
📄 patterns/01-layout-shell.md 3.6 KB
📄 patterns/02-navigation-menus.md 3.2 KB
📄 patterns/03-forms.md 3.4 KB
📄 patterns/04-data-table.md 4 KB
📄 patterns/05-modal-drawer.md 3.1 KB
📄 patterns/06-search.md 3.8 KB
📄 patterns/07-notifications.md 3 KB
📄 patterns/08-upload.md 3.6 KB
📄 patterns/09-theming.md 3.2 KB
📄 patterns/10-accessibility.md 6.8 KB
📄 protocols/DECISIONS.md 1.6 KB
📄 protocols/OUTPUT_CONTRACT.md 923 B
📄 protocols/UI_SPEC.md 2.7 KB
📄 references/components.md 981 B
📄 references/tokens.md 1.6 KB
📄 starter/README.md 690 B
📄 starter/index.html 302 B
📄 starter/package-lock.json 91.8 KB
📄 starter/package.json 477 B
📄 starter/src/App.tsx 219 B
📄 starter/src/AppProviders.tsx 1.1 KB
📄 starter/src/main.tsx 248 B
📄 starter/src/pages/UsersPage.tsx 8.4 KB
📄 starter/src/pages/mockServer.ts 2 KB
📄 starter/src/pages/types.ts 519 B
📄 starter/src/theme.ts 636 B
📄 starter/tsconfig.json 400 B
📄 starter/vite.config.ts 136 B