2021-09-25 08:51:32 +00:00
---
category: Components
type: Feedback
title: Notification
cover: https://gw.alipayobjects.com/zos/alicdn/Jxm5nw61w/Notification.svg
---
Display a notification message globally.
## When To Use
2021-12-04 17:06:31 +00:00
To display a notification message at any of the four corners of the viewport. Typically it can be used in the following cases:
2021-09-25 08:51:32 +00:00
- A notification with complex content.
2021-12-04 17:06:31 +00:00
- A notification providing a feedback based on the user interaction. Or it may show some details about upcoming steps the user may have to follow.
2021-09-25 08:51:32 +00:00
- A notification that is pushed by the application.
## API
- `notification.success(config)`
- `notification.error(config)`
- `notification.info(config)`
- `notification.warning(config)`
- `notification.warn(config)`
- `notification.open(config)`
- `notification.close(key: String)`
- `notification.destroy()`
The properties of config are as follows:
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| bottom | Distance from the bottom of the viewport, when `placement` is `bottomRight` or `bottomLeft` (unit: pixels). | string | `24px` | |
2022-01-01 02:34:37 +00:00
| btn | Customized close button | VNode \| () => VNode | - | |
2021-09-25 08:51:32 +00:00
| class | Customized CSS class | string | - | |
2022-01-01 02:34:37 +00:00
| description | The content of notification box (required) | string\| VNode \| () => VNode | - | |
2021-09-25 08:51:32 +00:00
| duration | Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically | number | 4.5 | |
| getContainer | Return the mount node for Notification | () => HTMLNode | () => document.body | |
2022-01-01 02:34:37 +00:00
| icon | Customized icon | VNode \| () => VNode | - | |
2021-09-25 08:51:32 +00:00
| key | The unique identifier of the Notification | string | - | |
2022-01-01 02:34:37 +00:00
| message | The title of notification box (required) | string\| VNode \| () => VNode | - | |
2021-09-25 08:51:32 +00:00
| placement | Position of Notification, can be one of `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` | |
| style | Customized inline style | Object \| string | - | |
| onClose | Specify a function that will be called when the close button is clicked | Function | - | |
| onClick | Specify a function that will be called when the notification is clicked | Function | - | |
| top | Distance from the top of the viewport, when `placement` is `topRight` or `topLeft` (unit: pixels). | string | `24px` | |
2022-01-01 02:34:37 +00:00
| closeIcon | custom close icon | VNode \| () => VNode | - | |
2021-09-25 08:51:32 +00:00
`notification` also provides a global `config()` method that can be used for specifying the default options. Once this method is used, all the notification boxes will take into account these globally defined options when displaying.
- `notification.config(options)`
2022-01-01 02:34:37 +00:00
> When you use `ConfigProvider` for global configuration, the system will automatically start RTL mode by default.(4.3.0+)
>
> When you want to use it alone, you can start the RTL mode through the following settings.
2021-09-25 08:51:32 +00:00
```js
notification.config({
placement: 'bottomRight',
bottom: '50px',
duration: 3,
2022-01-01 02:34:37 +00:00
rtl: true,
2021-09-25 08:51:32 +00:00
});
```
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| bottom | Distance from the bottom of the viewport, when `placement` is `bottomRight` or `bottomLeft` (unit: pixels). | string | `24px` | |
| duration | Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically | number | 4.5 | |
| getContainer | Return the mount node for Notification | () => HTMLNode | () => document.body | |
| placement | Position of Notification, can be one of `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` | |
2022-01-01 02:34:37 +00:00
| rtl | Whether to enable RTL mode | boolean | false | |
2021-09-25 08:51:32 +00:00
| top | Distance from the top of the viewport, when `placement` is `topRight` or `topLeft` (unit: pixels). | string | `24px` | |
2022-01-01 02:34:37 +00:00
| closeIcon | custom close icon | VNode \| () => VNode | - | |
| maxCount | Max Notification show, drop oldest if exceed limit | number | - | 3.0 |