ant-design/components/badge/demo/colorful.md

65 lines
1.2 KiB
Markdown
Raw Normal View History

---
order: 8
title:
zh-CN: 多彩徽标
en-US: Colorful Badge
---
## zh-CN
2020-03-17 17:13:16 +08:00
我们添加了多种预设色彩的徽标样式,用作不同场景使用。如果预设值不能满足你的需求,可以设置为具体的色值。
## en-US
2020-03-17 17:13:16 +08:00
We preset a series of colorful Badge styles for use in different situations. You can also set it to a hex color string for custom color.
2019-05-07 14:57:32 +08:00
```jsx
import { Badge, Divider } from 'antd';
2019-05-07 14:57:32 +08:00
const colors = [
'pink',
'red',
'yellow',
'orange',
'cyan',
'green',
'blue',
'purple',
'geekblue',
'magenta',
'volcano',
'gold',
'lime',
];
ReactDOM.render(
<>
<Divider orientation="left">Presets</Divider>
<div>
2019-05-07 14:57:32 +08:00
{colors.map(color => (
<div key={color}>
<Badge color={color} text={color} />
</div>
))}
</div>
<Divider orientation="left">Custom</Divider>
<div>
<Badge color="#f50" text="#f50" />
<br />
<Badge color="#2db7f5" text="#2db7f5" />
<br />
<Badge color="#87d068" text="#87d068" />
<br />
<Badge color="#108ee9" text="#108ee9" />
</div>
</>,
2019-05-07 14:57:32 +08:00
mountNode,
);
2019-05-07 14:57:32 +08:00
```
2019-05-07 14:57:32 +08:00
```css
.ant-tag {
margin-bottom: 8px;
}
2019-05-07 14:57:32 +08:00
```