--- name: ant-design description: Builds enterprise React applications with Ant Design's comprehensive component library. Use when creating admin dashboards, data tables, complex forms, or enterprise UIs with consistent design language. --- # Ant Design Enterprise-class React UI library with comprehensive components for admin interfaces. ## Quick Start ```bash npm install antd ``` ```tsx import React from 'react'; import { ConfigProvider, Button, Space } from 'antd'; function App() { return ( ); } ``` ## Core Components ### Button ```tsx import { Button, Space } from 'antd'; import { SearchOutlined, DownloadOutlined } from '@ant-design/icons'; // Types // Sizes // States // With icons ); } ``` ### Table ```tsx import { Table, Tag, Space, Button } from 'antd'; const columns = [ { title: 'Name', dataIndex: 'name', key: 'name', sorter: (a, b) => a.name.localeCompare(b.name), render: (text) => {text}, }, { title: 'Age', dataIndex: 'age', key: 'age', sorter: (a, b) => a.age - b.age, }, { title: 'Status', dataIndex: 'status', key: 'status', filters: [ { text: 'Active', value: 'active' }, { text: 'Inactive', value: 'inactive' }, ], onFilter: (value, record) => record.status === value, render: (status) => ( {status.toUpperCase()} ), }, { title: 'Action', key: 'action', render: (_, record) => ( Edit Delete ), }, ]; console.log(selectedRowKeys), }} /> ``` ### Modal ```tsx import { Modal, Button } from 'antd'; import { useState } from 'react'; import { ExclamationCircleFilled } from '@ant-design/icons'; function ModalDemo() { const [open, setOpen] = useState(false); return ( <> setOpen(false)} onCancel={() => setOpen(false)} okText="Confirm" cancelText="Cancel" >

Modal content here...

); } // Confirmation modal const { confirm } = Modal; function showConfirm() { confirm({ title: 'Do you want to delete these items?', icon: , content: 'This action cannot be undone.', onOk() { return deleteItems(); }, onCancel() {}, }); } ``` ### Notification & Message ```tsx import { notification, message, Button, Space } from 'antd'; // Notification (corner popup) const [api, contextHolder] = notification.useNotification(); const openNotification = () => { api.success({ message: 'Success', description: 'Your changes have been saved.', placement: 'topRight', duration: 4.5, }); }; <> {contextHolder} // Message (top center toast) const [messageApi, messageContextHolder] = message.useMessage(); const showMessage = () => { messageApi.success('Operation completed successfully'); messageApi.error('Something went wrong'); messageApi.warning('Please check your input'); messageApi.loading('Loading...'); }; ``` ### Menu and Navigation ```tsx import { Menu, Breadcrumb } from 'antd'; import { HomeOutlined, SettingOutlined, UserOutlined, } from '@ant-design/icons'; // Sidebar menu const menuItems = [ { key: 'home', icon: , label: 'Home', }, { key: 'users', icon: , label: 'Users', children: [ { key: 'list', label: 'User List' }, { key: 'add', label: 'Add User' }, ], }, { key: 'settings', icon: , label: 'Settings', }, ]; navigate(key)} /> // Breadcrumb }, { href: '/users', title: 'Users' }, { title: 'John Doe' }, ]} /> ``` ### Tabs ```tsx import { Tabs } from 'antd'; console.log(key)} /> ``` ### Card ```tsx import { Card, Avatar, Skeleton } from 'antd'; import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons'; const { Meta } = Card; } actions={[ , , , ]} > } title="Card title" description="This is the card description" /> // Loading state ``` ### Drawer ```tsx import { Drawer, Button, Form, Input, Select, Space } from 'antd'; function DrawerForm() { const [open, setOpen] = useState(false); return ( <> setOpen(false)} extra={ } >
); } ``` ## Theming ### Design Tokens ```tsx import { ConfigProvider, theme } from 'antd'; // Custom theme // Dark mode // Compact mode // Combined algorithms ``` ### Using Theme Tokens ```tsx import { theme } from 'antd'; function MyComponent() { const { token } = theme.useToken(); return (
Styled with tokens
); } ``` ## Layout ```tsx import { Layout, Menu } from 'antd'; const { Header, Sider, Content, Footer } = Layout; function AppLayout() { const [collapsed, setCollapsed] = useState(false); return (
Content here
My App 2024
); } ``` ## Data Entry ### Select with Search ```tsx import { Select } from 'antd'; // With grouping