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: Ant Design (React) — Practical Front-end Design Skill4---56# Ant Design (React) — Practical Front-end Design Skill78Use this skill when you are building a React UI with **Ant Design (antd)** and want **consistent, non-ugly** screens fast.910## When to use11- The project uses **React** + **Ant Design**12- You need to design/implement pages with: **Layout**, **Menu**, **Form**, **Table**, **Modal**, **Drawer**, **Steps**, **Tabs**, **Pagination**13- You need to implement **theme tokens** (colors, radius, typography, spacing)14- You want predictable UI patterns (CRUD screens, dashboards, settings pages)1516## Default workflow (do this order)171) Confirm stack: React + antd version (v5+ assumed).182) Choose page pattern:19 - CRUD list (Table) + filters (Form) + actions (Modal/Drawer)20 - Wizard (Steps)21 - Settings (Form + Cards)22 - Dashboard (Grid + Cards + Charts)233) Build layout skeleton first:24 - `Layout` + `Sider` + `Header` + `Content`25 - Navigation with `Menu`264) Build the main interaction component:27 - Forms: `Form`, `Form.Item`, `Input`, `Select`, `DatePicker`, `Switch`28 - Tables: `Table` + column definitions + row actions295) Add feedback loop:30 - `message`, `notification`, `Modal.confirm`316) Apply theming/tokens via `ConfigProvider` (global) and component-level overrides.327) Verify:33 - Empty states34 - Loading states35 - Error states36 - Mobile responsiveness (at least: 360px layout sanity)3738## Component patterns (copy/paste mental models)39### Layout40- Use `Layout` with `Sider` (collapsible), `Header` for top actions, `Content` scroll.41- Put page title + primary CTA in a `Flex` (or `Space`) row.4243### Forms44- Keep forms vertical; align labels consistently.45- Use `Form` + `Form.Item` rules for validation; avoid custom validation unless necessary.46- Use `Form.useForm()` and `form.setFieldsValue()` for edit flows.4748### Tables (CRUD)49- Columns:50 - left: identifier/name51 - middle: important attributes52 - right: actions (Edit/Delete)53- Use `rowKey` always.54- Use server-side pagination for real apps.5556### Modals/Drawers57- **Modal** for short forms.58- **Drawer** for longer forms or when you want context kept.5960## Theming / Tokens (AntD v5)61Ant Design v5 uses **Design Tokens** and CSS-in-JS.6263### Global theme64Wrap your app in `ConfigProvider`:6566```tsx67import { ConfigProvider, theme } from 'antd';6869export function AppProviders({ children }: { children: React.ReactNode }) {70 return (71 <ConfigProvider72 theme={{73 algorithm: theme.defaultAlgorithm,74 token: {75 colorPrimary: '#1677ff',76 borderRadius: 10,77 fontSize: 14,78 },79 components: {80 Button: { controlHeight: 40 },81 Layout: { headerBg: '#ffffff' },82 },83 }}84 >85 {children}86 </ConfigProvider>87 );88}89```9091### Dark mode92Use `theme.darkAlgorithm` and keep tokens consistent:9394```tsx95const isDark = true;9697<ConfigProvider98 theme={{99 algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm,100 token: { colorPrimary: '#7c3aed' },101 }}102/>103```104105### Component-level overrides106Use `components.<ComponentName>` for specific tweaks (Button, Input, Table, etc.).107108## References109- Read **README.md** for the full “how-to” (setup + patterns + examples).110- Use `protocols/` when you want LLM-first contracts (describe UIs as data, then generate code deterministically).111- Read `references/tokens.md` for a tokens cookbook.112- Read `references/components.md` for practical page recipes (CRUD, Settings, Wizard).113- Use `examples/` when you want ready-to-copy AntD screens.114- Use `starter/` when you need a runnable Vite + React + AntD skeleton.115116## Guardrails117- Assume Ant Design v5+ (tokens). If project is v4 (Less variables), stop and ask.118- Prefer built-in components and patterns over custom CSS.119- Avoid over-theming: set a small set of tokens and only override components when needed.