acrool / acrool-react-toaster

This is a toast message function for React development notifications

Home Page:https://acrool-react-toaster.pages.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
  • Support show limit
  • Support show position: top, bottom, left, center, right
  • Call via global method
  • Configurable disappearance delay seconds
  • Plug and unplug using @acrool/react-portal and framer-motion

Install

yarn add framer-motion @acrool/react-toaster

in your packages. (Make the version of styled-component you use match the version of styled-component used in acrool-react-gird)

"resolutions": {
    "framer-motion": "^11.x"
}

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
                defaultTimeout={3000}
                limit={6}
                position={{
                    vertical: 'top',
                    horizontal: 'center',
                }}
            />
        </div>
    );
};

then in your page

import {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.danger

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

Play react-editext-example

License

MIT © Acrool & Imagine

About

This is a toast message function for React development notifications

https://acrool-react-toaster.pages.dev/

License:MIT License


Languages

Language:TypeScript 67.6%Language:MDX 16.2%Language:CSS 7.6%Language:JavaScript 4.6%Language:SCSS 3.0%Language:Shell 1.0%