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

1.2.8 • Public • Published

@jdthornton/toast

npm (scoped) npm bundle size (minified)

React toast context and list component.

Demo

https://jdthornton.github.io/#/toast

Install

$ npm install @jdthornton/toast

Usage

import { ToastProvider, Toaster, useAddToast } from "@jdthornton/toast";
import '@jdthornton/toast/styles.css';

function AddToastButton(){
  const addToast = useAddToast();
  const handleAddToastButtonClick = () => {
    addToast("Here is a toast to you!")
  }
  return(
    <button type="button" onClick={handleAddToastButtonClick}>
      Add Toast
    </button>
  )
}

function App(){
  return(
    <ToastProvider>
      <Toaster />
      <AddToastButton />
    </ToastProvider>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @jdthornton/toast

Weekly Downloads

2

Version

1.2.8

License

MIT

Unpacked Size

23.6 kB

Total Files

30

Last publish

Collaborators

  • jdthornton