sp-react-notifications

1.0.23 • Public • Published

sp-notification

Simple notification package for Sharepoint Framework React Webparts

Install

npm install sp-react-notifications

Dependencies

Project is supposed to be used within Sharepoint Framework react WebParts, and it assumes following packages:

  • react & react-dom ^16.13.1
  • office-ui-fabric-react ^7.174.1
  • uuid

Usage

import { SPnotify } from 'sp-notifications';

// ...

<button onClick={() => SPnotify({
    // text shown on the notification, can also be a ReactElement for more sophisticated notifications
    message: "Test message",
    // constant from office-ui-fabric-react. Optional, default = info
    messageType: MessageBarType.severeWarning, 
    // buttons shown on the notification. Optional, default = true
    isMultiline: false,
    // Timeout (in miliseconds) after withc the notification is dismissed. Optional, default = 5000
    timeout: 5000,
    // Additional buttons appearing on the notification. Optional, default []
    messageActions: [ 
        {
            text: 'Yes',
            onClick: () => console.log('text'),
            dismiss: true,
        },
        {
            text: 'No',
            onClick: () => console.log('notext'),
        }
    ]
})}>
    notify me
</button>

Package Sidebar

Install

npm i sp-react-notifications

Weekly Downloads

1

Version

1.0.23

License

MIT

Unpacked Size

207 kB

Total Files

10

Last publish

Collaborators

  • rast999