🍫 React Snackbar Alert

No Progress Bar

By default, a progress bar is shown to indicate the time before the snackbar is removed. This can be done in one of two ways:

  • Setting the progressBar prop on the SnackbarProvider to false to disable for all snackbars
  • Setting the progressBar property on the object passed to createSnackbar to false to disable for a specific snackbar
import React from 'react';

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

export default function NoProgressBarExample() {
  return (
    <SnackbarProvider progressBar={false}>
      <Container />
    </SnackbarProvider>
  );
}

const Container = wrapComponent(function({ createSnackbar }) {
  function showSnackbar() {
    createSnackbar({
      message: 'Hello Snackbar!'
    });
  }

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