Branch: master
Clone or download
Latest commit 9cbc662 Feb 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets add removeNotice api.Fixes #3 #4 Jul 27, 2015
examples Merge pull request #47 from HeskeyBaozi/master Nov 1, 2018
src update Feb 11, 2019
tests update Feb 11, 2019
.editorconfig first commit May 3, 2015
.gitignore add max number of notices show Apr 16, 2018
.travis.yml fix: npm dist file Jul 31, 2017
HISTORY.md support onClick Oct 17, 2018
LICENSE.md Added LICENSE.md Dec 21, 2016
README.md Update README.md Jul 30, 2018
index.js 1.0.0 Jun 16, 2015
package.json bump 3.3.1 Feb 11, 2019

README.md

rc-notification


React Notification UI Component

NPM version build status Test coverage gemnasium deps node version npm download

Development

npm install
npm start

Example

http://localhost:8000/examples/

online example: http://react-component.github.io/notification/examples/

Feature

  • support ie9,ie9+,chrome,firefox,safari

install

rc-notification

Usage

var Notification = require('rc-notification');
Notification.newInstance({}, notification => {
  notification.notice({
    content: 'content'
  });
});

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

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)
style Object { right: '50%' } additional style for single notice node.
maxCount number max notices show, drop first notice if exceed limit
closeIcon ReactNode specific the close icon.

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-notification is released under the MIT license.