Notification
Display a notification message globally.
#
When To UseTo display a notification message at any of the four corners of the viewport. Typically it can be used in the following cases:
- A notification with complex content.
- 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.
- A notification that is pushed by the application.
#
Examples#
Basic#
Manual close by hooks return value#
Manual close by key#
Destroy all notification#
With icon#
Customized duration#
Handle Promise#
API#
Methodsnotification.open: (config) => [Promise, closeFn]
notification.close: (key: string) => void
notification.destroy: () => void
#
ConfigArgument | Type | Default | Description |
---|---|---|---|
key | string | - | key of the notification |
icon | ReactNode | - | icon of the notification |
content | ReactNode | - | content of the notification |
duration | number | Infinity | time(ms) before auto-dismiss. |