npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-top-toast

v1.0.3

Published

Re-usable toast component for react.

Downloads

3

Readme

react-top-toast

Re-usable toast component for react js (Beta).

NPM JavaScript Style Guide

Install

npm install react-top-toast
or
yarn add react-top-toast

Screenshots

screenshot 1

Mandatory parameters

It takes 2 mandatory parameters:

  1. message to be shown
  2. type of theme (success, error, info, warning) any one of these in lowercase.

Can be used with message parameters only if not passing third optional object parameters.

Other parameters:

  1. third parameters must be enclosed in object. supported object keys are:
{
    borderBottom: boolean, //(default false)
    borderSide: boolean, //(default true, first priority will be given to borderSide if borderBottom is also true)
    duration: number, //(default 5seconds , must be provided in miliseconds, eg: 1000ms = 1s)
    animation: string, //'bounce' or 'scale' or 'shake',  
    darkMode: boolean //(default false),
    hideProgress: boolean //(default false)
}

If borderSide is false then solid background color will be visible. same in case of both (borderSide and borderBottom false value)

Usage in same component


import ToastContainer, {showToast} from 'react-top-toast';

<section>

        <button onClick={() => showToast('Success message toast.', 'success')}>Success</button>
        <button onClick={() => showToast('Error message toast.', 'error')}>Error</button>
        <button onClick={() => showToast('Info message toast.', 'info')}>Info</button>
        <button onClick={() => showToast('Warning message toast.', 'warning')}>Warning</button>
        <br></br>
        <button onClick={() => showToast('Success solid background.', 'success', {
        borderSide:false})}
        >Success with solid background</button>
        <br></br>

        <button onClick={() => showToast('Success message toast with optional arguments.', 'success' , {
            borderBottom: true,
            darkMode: true,
            hideProgress:true,
            duration: 4000,
            animation: 'bounce'
        })}>Success toast</button>


<ToastContainer/>
</section>

Usage in Parent and child component


import ToastContainer from 'react-top-toast';

<section>
<Nav/>
<Home/>
<Footer>
<ToastContainer/>
</section>

inside Home.tsx can follow the same process by just importing {showToast} from 'react-top-toast';

License

MIT ©