React Notification UI Component
import Notification from 'rc-notification';
Notification.newInstance({}, notification => {
notification.notice({
content: 'content'
});
});
IE / Edge |
Firefox |
Chrome |
Safari |
Electron |
---|---|---|---|---|
IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
online example: https://notification-react-component.vercel.app
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 |
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 microsoft/TypeScript#28960. |
remove single notice with specified key
destroy current notification
npm test
npm run chrome-test
npm run coverage
open coverage/ dir
rc-notification is released under the MIT license.