Website Markup Using Ant Design
Ant Design is a component system from Alibaba/Ant Group, the de facto standard for enterprise React applications in CIS and Asian markets. Version 5.x transitioned from Less to CSS-in-JS (via @ant-design/cssinjs), enabling runtime theming and design tokens without rebuilding.
Installation
npm install antd @ant-design/icons
// src/main.tsx
import { ConfigProvider, App as AntApp } from 'antd';
import ruRU from 'antd/locale/ru_RU';
import theme from './antd-theme';
function Root() {
return (
<ConfigProvider locale={ruRU} theme={theme}>
<AntApp>
<App />
</AntApp>
</ConfigProvider>
);
}
Theme Customization via Design Tokens
In Ant Design 5, theming is done through an algorithm and token system. No need to override Less variables:
// src/antd-theme.ts
import { ThemeConfig, theme as antTheme } from 'antd';
const { defaultAlgorithm, darkAlgorithm } = antTheme;
const lightTheme: ThemeConfig = {
algorithm: defaultAlgorithm,
token: {
// Base colors
colorPrimary: '#2563eb',
colorSuccess: '#16a34a',
colorWarning: '#d97706',
colorError: '#dc2626',
colorInfo: '#0891b2',
// Typography
fontFamily: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
fontSize: 14,
fontSizeLG: 16,
fontSizeHeading1: 38,
fontSizeHeading2: 30,
fontSizeHeading3: 24,
// Padding
padding: 16,
paddingLG: 24,
paddingXL: 32,
margin: 16,
marginLG: 24,
// Form
borderRadius: 8,
borderRadiusLG: 12,
// Background colors
colorBgContainer: '#ffffff',
colorBgLayout: '#f5f7fa',
colorBorderSecondary: '#e5e7eb',
},
components: {
Button: {
controlHeight: 40,
controlHeightLG: 48,
controlHeightSM: 32,
paddingContentHorizontal: 20,
borderRadius: 8,
},
Card: {
paddingLG: 24,
borderRadius: 12,
},
Table: {
headerBg: '#f9fafb',
borderColor: '#f3f4f6',
},
Form: {
labelColor: '#374151',
labelFontSize: 14,
},
Menu: {
itemBorderRadius: 8,
},
},
};
export default lightTheme;
Page Structure with Ant Design Layout
import { Layout, Menu, Breadcrumb, Avatar, Badge, Space } from 'antd';
import { BellOutlined, UserOutlined, MenuFoldOutlined } from '@ant-design/icons';
import { useState } from 'react';
const { Header, Sider, Content, Footer } = Layout;
const AppLayout: FC<{ children: ReactNode }> = ({ children }) => {
const [collapsed, setCollapsed] = useState(false);
return (
<Layout style={{ minHeight: '100vh' }}>
<Sider
collapsible
collapsed={collapsed}
onCollapse={setCollapsed}
theme="light"
style={{
boxShadow: '1px 0 8px rgba(0,0,0,0.06)',
overflow: 'auto',
position: 'sticky',
top: 0,
height: '100vh',
}}
>
<div style={{ padding: '16px 24px', fontWeight: 700, fontSize: 18 }}>
{collapsed ? 'L' : 'Logo'}
</div>
<Menu
mode="inline"
defaultSelectedKeys={['dashboard']}
items={menuItems}
/>
</Sider>
<Layout>
<Header
style={{
background: '#fff',
padding: '0 24px',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
borderBottom: '1px solid #f3f4f6',
}}
>
<Breadcrumb items={breadcrumbItems} />
<Space size={16}>
<Badge count={3}>
<BellOutlined style={{ fontSize: 18 }} />
</Badge>
<Avatar icon={<UserOutlined />} />
</Space>
</Header>
<Content style={{ margin: 24 }}>
{children}
</Content>
<Footer style={{ textAlign: 'center', color: '#9ca3af' }}>
© 2025 Company. All rights reserved.
</Footer>
</Layout>
</Layout>
);
};
Forms with Validation
import { Form, Input, Select, Button, message } from 'antd';
interface ContactFormValues {
name: string;
email: string;
department: string;
message: string;
}
const ContactForm = () => {
const [form] = Form.useForm<ContactFormValues>();
const [loading, setLoading] = useState(false);
const onFinish = async (values: ContactFormValues) => {
setLoading(true);
try {
await submitContact(values);
message.success('Message sent');
form.resetFields();
} catch {
message.error('Send failed');
} finally {
setLoading(false);
}
};
return (
<Form
form={form}
layout="vertical"
onFinish={onFinish}
requiredMark="optional"
>
<Form.Item
name="name"
label="Name"
rules={[{ required: true, message: 'Enter name' }]}
>
<Input placeholder="Ivan Ivanov" size="large" />
</Form.Item>
<Form.Item
name="email"
label="Email"
rules={[
{ required: true, message: 'Enter email' },
{ type: 'email', message: 'Invalid email' },
]}
>
<Input type="email" placeholder="[email protected]" size="large" />
</Form.Item>
<Form.Item name="department" label="Department">
<Select
size="large"
placeholder="Select department"
options={[
{ value: 'sales', label: 'Sales' },
{ value: 'support', label: 'Support' },
]}
/>
</Form.Item>
<Form.Item
name="message"
label="Message"
rules={[{ required: true, min: 10, message: 'Minimum 10 characters' }]}
>
<Input.TextArea rows={4} placeholder="Describe request..." showCount maxLength={500} />
</Form.Item>
<Form.Item>
<Button
type="primary"
htmlType="submit"
size="large"
loading={loading}
block
>
Send
</Button>
</Form.Item>
</Form>
);
};
Table with Sorting and Filtering
import { Table, Tag, Space } from 'antd';
import type { ColumnsType } from 'antd/es/table';
interface DataItem {
key: string;
name: string;
status: 'active' | 'inactive' | 'pending';
created: string;
}
const columns: ColumnsType<DataItem> = [
{
title: 'Name',
dataIndex: 'name',
sorter: (a, b) => a.name.localeCompare(b.name),
},
{
title: 'Status',
dataIndex: 'status',
filters: [
{ text: 'Active', value: 'active' },
{ text: 'Inactive', value: 'inactive' },
],
onFilter: (value, record) => record.status === value,
render: (status) => (
<Tag color={status === 'active' ? 'green' : status === 'pending' ? 'orange' : 'red'}>
{status === 'active' ? 'Active' : status === 'pending' ? 'Pending' : 'Inactive'}
</Tag>
),
},
{
title: 'Creation Date',
dataIndex: 'created',
sorter: (a, b) => new Date(a.created).getTime() - new Date(b.created).getTime(),
},
];
Timeline
ConfigProvider and theme setup: 2–4 hours. Ant Design significantly speeds up page development with forms, tables, and admin interfaces through ready-made components. Full admin-panel with CRUD operations: 5–10 days depending on entity count.







