Skip to content

acrool/acrool-react-toaster

Repository files navigation

Acrool React Toaster

Acrool React Toaster Logo

This is a toast message function for React development notifications

NPM npm npm

npm downloads npm

Features

  • Supports 5 status colors: default, success, info, warning, danger
  • Call via global method
  • Configurable disappearance delay seconds

Install

yarn add @acrool/react-toaster

Usage

add in your index.tsx

import "@acrool/react-toaster/dist/index.css";

add in your App.tsx

import {ToasterPortal} from "@acrool/react-toaster";

const App = () => {
    return (
        <div>
            <BaseUsed/>
            <ToasterPortal timeout={3000}/>
        </div>
    );
};

then in your page

import {EStatus, toast} from '@acrool/react-toaster';

const Example = () => {
    return (
        <div>
            <button type="button" onClick={() => toast({message: 'useToaster message'})}>
                useToaster message
            </button>
        </div>
    );
};
  • toast
  • toast.success
  • toast.info
  • toast.warning
  • toast.error

There is also a example that you can play with it:

Play react-editext-example

License

MIT © Acrool & Imagine