# notification
**Repository Path**: mirrors_react-component/notification
## Basic Information
- **Project Name**: notification
- **Description**: React Notification
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-18
- **Last Updated**: 2025-06-12
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# @rc-component/notification
React Notification UI Component
[![NPM version][npm-image]][npm-url] [](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url]
[npm-image]: http://img.shields.io/npm/v/@rc-component/notification.svg?style=flat-square
[npm-url]: http://npmjs.org/package/@rc-component/notification
[github-actions-image]: https://github.com/react-component/notification/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/notification/actions
[coveralls-image]: https://img.shields.io/coveralls/react-component/notification.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/notification?branch=master
[download-image]: https://img.shields.io/npm/dm/@rc-component/notification.svg?style=flat-square
[download-url]: https://npmjs.org/package/@rc-component/notification
[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/notification
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/notification
## Install
[](https://npmjs.org/package/@rc-component/notification)
## Usage
```js
import Notification from '@rc-component/notification';
Notification.newInstance({}, (notification) => {
notification.notice({
content: 'content',
});
});
```
## Compatibility
| Browser | Supported Version |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| [
Firefox](http://godban.github.io/browsers-support-badges/) | last 2 versions |
| [
Chrome](http://godban.github.io/browsers-support-badges/) | last 2 versions |
| [
Safari](http://godban.github.io/browsers-support-badges/) | last 2 versions |
| [
Electron](http://godban.github.io/browsers-support-badges/) | last 2 versions |
## Example
http://localhost:8001
online example: https://notification-react-component.vercel.app
## API
### Notification.newInstance(props, (notification) => void) => void
props details:
name |
type |
default |
description |
prefixCls |
String |
|
prefix class name for notification container |
style |
Object |
{'top': 65, left: '50%'} |
additional style for notification container. |
getContainer |
getContainer(): HTMLElement |
|
function returning html node which will act as notification container |
maxCount |
number |
|
max notices show, drop first notice if exceed limit |
### notification.notice(props)
props details:
name |
type |
default |
description |
content |
React.Element |
|
content of notice |
key |
String |
|
id of this notice |
closable |
Boolean |
|
whether show close button |
onClose |
Function |
|
called when notice close |
duration |
number |
1.5 |
after duration of time, this notice will disappear.(seconds) |
showProgress |
boolean |
false |
show with progress bar for auto-closing notification |
pauseOnHover |
boolean |
true |
keep the timer running or not on hover |
style |
Object |
{ right: '50%' } |
additional style for single notice node. |
closeIcon |
ReactNode |
|
specific the close icon. |
props |
Object |
|
An object that can contain data-* , aria-* , or role props, to be put on the notification div . This currently only allows data-testid instead of data-* in TypeScript. See https://github.com/microsoft/TypeScript/issues/28960. |
### notification.removeNotice(key:string)
remove single notice with specified key
### notification.destroy()
destroy current notification
## Test Case
```
npm test
npm run chrome-test
```
## Coverage
```
npm run coverage
```
open coverage/ dir
## License
@rc-component/notification is released under the MIT license.