🍫 React Snackbar Alert

Themes

By default, snackbars have a black background and no icon. This can be changed by specifying the theme property on the object passed to createSnackbar.

The supported themes are:

  • default
  • info
  • success
  • warning
  • error
import React from 'react';

import { SnackbarProvider, wrapComponent } from 'react-snackbar-alert';

export default function ThemeExample() {
  return (
    <SnackbarProvider>
      <Container />
    </SnackbarProvider>
  );
}

const Container = wrapComponent(function({ createSnackbar }) {
  function showSnackbar() {
    createSnackbar({
      message: 'Great success!',
      theme: 'success'
    });
  }

  return (
    <div>
      <button onClick={showSnackbar}>Show Snackbar</button>
    </div>
  );
});