1.0.3 • Published 4 years ago

@mindk/react-material-snackbars v1.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

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>
  );
}