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

38 lines
887 B
Markdown
Raw Normal View History

2018-07-19 19:24:19 +08:00
---
order: 0
title:
zh-CN: 基本用法
en-US: Basic
---
## zh-CN
2018-08-30 22:53:24 +08:00
使用 `<Icon />` 标签声明组件,指定图标对应的 `type` 属性。可以通过 `theme` 属性来设置不同的主题风格的图标,也可以通过设置 `spin` 属性来实现动画旋转效果。
2018-07-19 19:24:19 +08:00
## en-US
2018-08-30 22:53:24 +08:00
Use tag `<Icon />` to create an icon and set its type in the `type` prop. Specific the `spin` property to show spinning animation and the `theme` property to switch different themes.
2018-07-19 19:24:19 +08:00
2019-05-07 14:57:32 +08:00
```jsx
2018-07-19 19:24:19 +08:00
import { Icon } from 'antd';
ReactDOM.render(
2018-08-14 17:17:51 +08:00
<div className="icons-list">
<Icon type="home" />
2018-08-31 10:02:55 +08:00
<Icon type="setting" theme="filled" />
<Icon type="smile" theme="outlined" />
2018-08-24 17:36:22 +08:00
<Icon type="sync" spin />
<Icon type="smile" rotate={180} />
2018-08-24 17:36:22 +08:00
<Icon type="loading" />
2018-07-19 19:24:19 +08:00
</div>,
2019-05-07 14:57:32 +08:00
mountNode,
2018-07-19 19:24:19 +08:00
);
2019-05-07 14:57:32 +08:00
```
2018-08-14 17:17:51 +08:00
2018-09-02 19:11:47 +08:00
<style>
2018-08-14 17:17:51 +08:00
.icons-list > .anticon {
margin-right: 6px;
2018-09-02 19:11:47 +08:00
font-size: 24px;
2018-08-14 17:17:51 +08:00
}
2018-09-02 19:11:47 +08:00
</style>