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

39 lines
677 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';
2022-05-23 14:37:16 +08:00
import React from 'react';
2016-08-03 14:54:10 +08:00
const App: React.FC = () => (
<>
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
);
export default App;
2019-05-07 14:57:32 +08:00
```