← 返回
内容创作 中文

Ant Design Skill

Skill for efficiently building React UIs using Ant Design v5+ with layouts, forms, tables, modals, theming via ConfigProvider, and consistent component patte...
使用 Ant Design v5+ 高效构建 React UI 的技能,涵盖布局、表单、表格、模态框、通过 ConfigProvider 实现主题配置以及一致的组件模式。
felipeoff
内容创作 clawhub v0.1.0 1 版本 99753.2 Key: 无需
★ 3
Stars
📥 2,365
下载
💾 133
安装
1
版本
#latest

概述

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. 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.
  • 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.

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-28 19:16 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

content-creation

AdMapix

fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 295 📥 136,445
data-analysis

Sonarqube Analyzer

felipeoff
对自托管 SonarQube 项目进行分析,获取筛选后的问题,检查 Quality Gate 并提供自动修复方案。
★ 1 📥 1,840
content-creation

Baidu Wenku AIPPT

ide-rea
使用百度文库 AI 智能生成 PPT,自动根据内容选择模板。
★ 66 📥 46,156