An open API service indexing awesome lists of open source software.

https://github.com/acrool/acrool-react-toaster

This is a toast message function for React development notifications
https://github.com/acrool/acrool-react-toaster

react react-toaster toaster

Last synced: about 1 month ago
JSON representation

This is a toast message function for React development notifications

Awesome Lists containing this project

README

        

# Acrool React Toaster


Acrool React Toaster Logo


This is a toast message function for React development notifications

[![NPM](https://img.shields.io/npm/v/@acrool/react-toaster.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/react-toaster)
[![npm](https://img.shields.io/bundlejs/size/@acrool/react-toaster?style=for-the-badge)](https://github.com/acrool/@acrool/react-toaster/blob/main/LICENSE)
[![npm](https://img.shields.io/npm/l/@acrool/react-toaster?style=for-the-badge)](https://github.com/acrool/react-toaster/blob/main/LICENSE)

[![npm downloads](https://img.shields.io/npm/dm/@acrool/react-toaster.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/react-toaster)
[![npm](https://img.shields.io/npm/dt/@acrool/react-toaster.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/react-toaster)

## 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

```bash
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)

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

## Usage

add in your index.tsx
```tst
import "@acrool/react-toaster/dist/index.css";
```

add in your App.tsx

```tsx
import {ToasterPortal, themeMap} from "@acrool/react-toaster";
import CustomCheckIcon from '../../../assets/custom_check.svg?react';

const App = () => {
return (





);
};
```

then in your page
```tsx
import {toast} from '@acrool/react-toaster';

const Example = () => {
return (


toast({message: 'useToaster message'})}>
useToaster message


);
};
```

- toast
- toast.success
- toast.info
- toast.warning
- toast.danger

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

[![Play react-editext-example](https://raw.githubusercontent.com/acrool/acrool-react-toaster/main/play-in-example-button.svg)](https://acrool-react-toaster.pages.dev)

## License

MIT © [Acrool](https://github.com/acrool) & [Imagine](https://github.com/imagine10255)