ant-design/components/alert/demo/banner.md

36 lines
622 B
Markdown
Raw Normal View History

2016-08-03 14:54:10 +08:00
---
order: 6
iframe: 250
2016-08-03 14:54:10 +08:00
title:
zh-CN: 顶部公告
en-US: Banner
---
## zh-CN
页面顶部通告形式,默认有图标且 `type` 为 'warning'。
2016-08-03 14:54:10 +08:00
## en-US
2017-03-22 17:32:52 +08:00
Display Alert as a banner at top of page.
2016-08-03 14:54:10 +08:00
2020-01-21 16:21:37 +08:00
```tsx
2016-08-03 14:54:10 +08:00
import { Alert } from 'antd';
export default () => (
<>
2016-08-03 14:54:10 +08:00
<Alert message="Warning text" banner />
<br />
2019-05-07 14:57:32 +08:00
<Alert
message="Very long warning text warning text text text text text text text"
banner
closable
/>
<br />
<Alert showIcon={false} message="Warning text without icon" banner />
<br />
<Alert type="error" message="Error text" banner />
</>
2018-11-28 15:00:03 +08:00
);
2019-05-07 14:57:32 +08:00
```