官方文档: https://4x-ant-design.antgroup.com/components/icon-cn
This example demonstrates how to use icons in Ant Design React.
import React from 'react';
import { HomeOutlined, UserOutlined, SettingOutlined } from '@ant-design/icons';
function App() {
return (
<>
<HomeOutlined />
<UserOutlined />
<SettingOutlined />
</>
);
}
import React from 'react';
import { Button } from 'antd';
import { DownloadOutlined, SearchOutlined } from '@ant-design/icons';
function App() {
return (
<>
<Button type="primary" icon={<DownloadOutlined />}>
Download
</Button>
<Button icon={<SearchOutlined />}>Search</Button>
</>
);
}
import React from 'react';
import { HomeOutlined } from '@ant-design/icons';
function App() {
return (
<>
<HomeOutlined style={{ fontSize: '16px' }} />
<HomeOutlined style={{ fontSize: '24px' }} />
<HomeOutlined style={{ fontSize: '32px' }} />
</>
);
}
import React from 'react';
import { HeartOutlined } from '@ant-design/icons';
function App() {
return (
<>
<HeartOutlined style={{ color: '#ff4d4f' }} />
<HeartOutlined style={{ color: '#52c41a' }} />
<HeartOutlined style={{ color: '#1890ff' }} />
</>
);
}