You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@procore/labs-toast-alert

Package Overview
Dependencies
Maintainers
175
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@procore/labs-toast-alert

Displays a temporary Toast notification

4.0.0
latest
Source
npmnpm
Version published
Weekly downloads
73
-21.51%
Maintainers
175
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 25 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts