---
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
}>Search
} />
```
### Form
```tsx
import { Form, Input, Select, Button, Checkbox, DatePicker } from 'antd';
function MyForm() {
const [form] = Form.useForm();
const onFinish = (values) => {
console.log('Form values:', values);
};
return (
Remember me
);
}
```
### 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',
},
];