ant-design/components/avatar/demo/basic.md

51 lines
1.0 KiB
Markdown
Raw Normal View History

2017-05-28 14:20:59 +08:00
---
order: 0
title:
zh-CN: 基本
en-US: Basic
---
## zh-CN
头像有三种尺寸,两种形状可选。
## en-US
Three sizes and two shapes are available.
2020-01-21 16:21:37 +08:00
```tsx
import { UserOutlined } from '@ant-design/icons';
2022-05-23 14:37:16 +08:00
import { Avatar } from 'antd';
import React from 'react';
2017-05-28 14:20:59 +08:00
const App: React.FC = () => (
<>
2017-06-19 12:13:33 +08:00
<div>
<Avatar size={64} icon={<UserOutlined />} />
<Avatar size="large" icon={<UserOutlined />} />
<Avatar icon={<UserOutlined />} />
<Avatar size="small" icon={<UserOutlined />} />
2017-06-19 12:13:33 +08:00
</div>
<div>
<Avatar shape="square" size={64} icon={<UserOutlined />} />
<Avatar shape="square" size="large" icon={<UserOutlined />} />
<Avatar shape="square" icon={<UserOutlined />} />
<Avatar shape="square" size="small" icon={<UserOutlined />} />
2017-06-19 12:13:33 +08:00
</div>
</>
2018-11-28 15:00:03 +08:00
);
export default App;
2019-05-07 14:57:32 +08:00
```
2017-06-19 12:13:33 +08:00
<style>
#components-avatar-demo-basic .ant-avatar {
margin-top: 16px;
margin-right: 16px;
}
2020-05-10 22:11:09 +08:00
.ant-row-rtl #components-avatar-demo-basic .ant-avatar {
margin-right: 0;
margin-left: 16px;
}
2017-06-19 12:13:33 +08:00
</style>