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)
- Confirm stack: React + antd version (v5+ assumed).
- Choose page pattern:
- CRUD list (Table) + filters (Form) + actions (Modal/Drawer)
- Wizard (Steps)
- Settings (Form + Cards)
- Dashboard (Grid + Cards + Charts)
- Build layout skeleton first:
Layout + Sider + Header + Content
- Navigation with
Menu
- Build the main interaction component:
- Forms:
Form, Form.Item, Input, Select, DatePicker, Switch
- Tables:
Table + column definitions + row actions
- Add feedback loop:
message, notification, Modal.confirm
- Apply theming/tokens via
ConfigProvider (global) and component-level overrides.
- 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.
- 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---2name: ant-design-skill3description: Front-end design skill for building React UIs with Ant Design (antd): component patterns, layout, forms, tables, and theming/tokens via ConfigProvider.4---5
6
7# Ant Design (React) — Practical Front-end Design Skill
8
9Use this skill when you are building a React UI with **Ant Design (antd)** and want **consistent, non-ugly** screens fast.
10
11## When to use
12- The project uses **React** + **Ant Design**
13- You need to design/implement pages with: **Layout**, **Menu**, **Form**, **Table**, **Modal**, **Drawer**, **Steps**, **Tabs**, **Pagination**
14- You need to implement **theme tokens** (colors, radius, typography, spacing)
15- You want predictable UI patterns (CRUD screens, dashboards, settings pages)
16
17## Default workflow (do this order)
181) Confirm stack: React + antd version (v5+ assumed).
192) Choose page pattern:
20 - CRUD list (Table) + filters (Form) + actions (Modal/Drawer)
21 - Wizard (Steps)
22 - Settings (Form + Cards)
23 - Dashboard (Grid + Cards + Charts)
243) Build layout skeleton first:
25 - `Layout` + `Sider` + `Header` + `Content`
26 - Navigation with `Menu`
274) Build the main interaction component:
28 - Forms: `Form`, `Form.Item`, `Input`, `Select`, `DatePicker`, `Switch`
29 - Tables: `Table` + column definitions + row actions
305) Add feedback loop:
31 - `message`, `notification`, `Modal.confirm`
326) Apply theming/tokens via `ConfigProvider` (global) and component-level overrides.
337) Verify:
34 - Empty states
35 - Loading states
36 - Error states
37 - Mobile responsiveness (at least: 360px layout sanity)
38
39## Component patterns (copy/paste mental models)
40### Layout
41- Use `Layout` with `Sider` (collapsible), `Header` for top actions, `Content` scroll.
42- Put page title + primary CTA in a `Flex` (or `Space`) row.
43
44### Forms
45- Keep forms vertical; align labels consistently.
46- Use `Form` + `Form.Item` rules for validation; avoid custom validation unless necessary.
47- Use `Form.useForm()` and `form.setFieldsValue()` for edit flows.
48
49### Tables (CRUD)
50- Columns:
51 - left: identifier/name
52 - middle: important attributes
53 - right: actions (Edit/Delete)
54- Use `rowKey` always.
55- Use server-side pagination for real apps.
56
57### Modals/Drawers
58- **Modal** for short forms.
59- **Drawer** for longer forms or when you want context kept.
60
61## Theming / Tokens (AntD v5)
62Ant Design v5 uses **Design Tokens** and CSS-in-JS.
63
64### Global theme
65Wrap your app in `ConfigProvider`:
66
67```tsx
68import { ConfigProvider, theme } from 'antd';
69
70export function AppProviders({ children }: { children: React.ReactNode }) {
71 return (
72 <ConfigProvider
73 theme={{
74 algorithm: theme.defaultAlgorithm,
75 token: {
76 colorPrimary: '#1677ff',
77 borderRadius: 10,
78 fontSize: 14,
79 },
80 components: {
81 Button: { controlHeight: 40 },
82 Layout: { headerBg: '#ffffff' },
83 },
84 }}
85 >
86 {children}
87 </ConfigProvider>
88 );
89}
90```
91
92### Dark mode
93Use `theme.darkAlgorithm` and keep tokens consistent:
94
95```tsx
96const isDark = true;
97
98<ConfigProvider
99 theme={{
100 algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm,
101 token: { colorPrimary: '#7c3aed' },
102 }}
103/>
104```
105
106### Component-level overrides
107Use `components.<ComponentName>` for specific tweaks (Button, Input, Table, etc.).
108
109## References
110- Read **README.md** for the full “how-to” (setup + patterns + examples).
111- Use `protocols/` when you want LLM-first contracts (describe UIs as data, then generate code deterministically).
112- Read `references/tokens.md` for a tokens cookbook.
113- Read `references/components.md` for practical page recipes (CRUD, Settings, Wizard).
114- Use `examples/` when you want ready-to-copy AntD screens.
115- Use `starter/` when you need a runnable Vite + React + AntD skeleton.
116
117## Guardrails
118- Assume Ant Design v5+ (tokens). If project is v4 (Less variables), stop and ask.
119- Prefer built-in components and patterns over custom CSS.
120- Avoid over-theming: set a small set of tokens and only override components when needed.