4.0.0 • Published 1 year ago

@procore/labs-toast-alert v4.0.0

Weekly downloads
654
License
SEE LICENSE IN LI...
Repository
github
Last release
1 year ago

Toast Alert

A package to display Core Toast notifications.

Importing

import {
  ToastAlertProvider,
  useToastAlertContext,
} from "@procore/labs-toast-alert";

Usage

function App() {
  return (
    <ToastAlertProvider>
      <ComponentWithToasts />
    </ToastAlertProvider>
  );
};

function ComponentWithToasts() {
  const { showToast, hideAllToasts } = useToastAlertContext();

  return (
    <>
      <button
        onClick={() => {
          showToast.success("Success toast description", {
            afterClose: () => console.log("Success toast closed!"),
          });
        }}
      >
        Show Success Toast
      </button>

      <button
        onClick={() => {
          showToast.error("Error toast description");
        }}
      >
        Show Error Toast
      </button>

      <button
        onClick={() => {
          hideAllToasts();
        }}
      >
        Hide All Toasts
      </button>
    </>
  );
};
4.0.0

1 year ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

4 years ago

3.0.0-rc-1

4 years ago

3.1.0-canary-1

4 years ago

1.1.0

4 years ago

2.0.0

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.0

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago