@mindk/react-material-snackbars

1.0.3 • Public • Published

react-material-snackbars

Notistack with PubSub

Docs

Installation

Install via npm

npm install --save @mindk/react-material-snackbars

Quick Example

1: Wrap your app inside a SnackbarProvider component: (see docs for a full list of available props)
Note: If you're using material-ui ThemeProvider, make sure SnackbarProvider is a child of it.

import SnackbarProvider from '@mindk/react-material-snackbars';

<SnackbarProvider>
  <App />
</SnackbarProvider>;

2: Send notifications in any files you need.

import React from 'react';

import { success, warning, info, error, notification } from '../.';

export default function SnackbarsDemo() {
  return (
    <div>
      <button type="button" onClick={() => success('Success message')}>
        Success
      </button>
      <button type="button" onClick={() => info('Info message')}>
        Info
      </button>
      <button type="button" onClick={() => warning('Warning message')}>
        Warning
      </button>
      <button type="button" onClick={() => error('Error message')}>
        Error
      </button>
      <button type="button" onClick={() => notification('Custom message')}>
        Custom
      </button>
    </div>
  );
}

Readme

Keywords

none

Package Sidebar

Install

npm i @mindk/react-material-snackbars

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

26.8 kB

Total Files

19

Last publish

Collaborators

  • izarudnyi
  • mchurylov
  • pmishchenko
  • rkritskiy