Notably Polite Mariner

    @procore/labs-toast-alert
    TypeScript icon, indicating that this package has built-in type declarations

    3.1.0 • Public • Published

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

    Keywords

    none

    Install

    npm i @procore/labs-toast-alert

    DownloadsWeekly Downloads

    5,710

    Version

    3.1.0

    License

    SEE LICENSE IN LICENSE

    Unpacked Size

    168 kB

    Total Files

    23

    Last publish

    Collaborators

    • noor.ali
    • ari-procore
    • alanprocore
    • jl4ever
    • james.lawson
    • ajaykumar-procore
    • dennis.heckman
    • tara.chambers
    • lalovar-procore
    • james.cleary
    • chadryder
    • devin.cunningham.procore
    • abhijit.patwardhan
    • maxscott_pc
    • lydiahara
    • sherylnapigkit
    • changprocore
    • apcarroll_procore
    • andy.mayer
    • bob.laskowski
    • vinaya-procore
    • r-pulling
    • kahliholmes
    • amanzhula-zoolatech
    • andrew.wheeler
    • leandro-proc
    • yadhu.prakash
    • jason-kaye
    • initbar-procore
    • jesse.olsen
    • jsoncummings
    • patrick.lardin
    • brad.urani
    • ian.nguyen
    • allenanle.procore
    • ismail.hassan
    • brookyboy009
    • uddhavjoglekar
    • dancingshell
    • justinmwatts
    • rysmithprocore
    • bostonaholic
    • robbiegprocore
    • jadamsss
    • jeremy.bouzigard
    • dallashall-procore
    • bates550
    • timdoherty
    • b.bookout
    • jalyng
    • chrisarevir
    • htael
    • espi
    • truthysystems
    • dev-account-admin
    • sseanwang
    • bhargavrnd
    • dannyphillips
    • farismmk
    • dannyporrello
    • mcclayton
    • gregburger
    • danny.ou
    • messanjah
    • eyvettesou
    • jgee67
    • chriszhang
    • arthurzhuk
    • cagmz
    • mariah_delaney
    • lukenispel
    • kimhin267
    • hyogman
    • juliana.hernandez
    • evan.freymiller
    • manuphatak
    • judy-lu-pc
    • procore-it-support
    • wilfredr
    • andrewburke-pc
    • jkleintech
    • rachel.arkebauer
    • aaronme
    • procore-npm-bot
    • lincolnp
    • james.dabbs-procore
    • laurenbrandsteinprocore
    • kimtodd
    • scottbieser-procore
    • fkennedy
    • zach.mckenzie.procore
    • natalie.walia
    • kapoorlakshya-procore
    • shayonj_procore
    • heplayskeys
    • mike.south
    • thomasoboyle
    • dischorde
    • derek-carter-procore
    • dlgasser
    • moises.narvaez-procore
    • cfprocore
    • rory.forster
    • lgm_procore
    • evan.waits
    • todd-andrew-procore
    • jeremy-marcus
    • israel-pereira
    • jmejia-fsl
    • kedar.procore
    • ersgonzalo
    • stephan-procore
    • aleclarsenprocore
    • himansudesai
    • yihai.zweifel
    • jay-rajan
    • jacky-lei
    • bpross22
    • peter.jin