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

https://github.com/afeiship/react-toast

Toast for react.
https://github.com/afeiship/react-toast

cmd react singleton toast use-command ve

Last synced: 3 months ago
JSON representation

Toast for react.

Awesome Lists containing this project

README

          

# react-toast
> Toast for react.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install -S @jswork/react-toast
```

## usage
1. import css
```scss
@import "~@jswork/react-toast/dist/style.css";

// or use sass
@import "~@jswork/react-toast/dist/style.scss";
```
2. import js
```js
import ReactToast, { useCommand } from '@jswork/react-toast/main';
import '@jswork/react-toast/dist/style.scss';

function App() {
const cmd1 = useCommand('t1');
const cmd2 = useCommand('t2');
return (



Build Time: {BUILD_TIME}


Toast content here.


Toast content here fixed.



cmd1.present()}>ShowToast
cmd1.dismiss()}>HideToast


cmd2.present({
children: 'Dynamically set content.',
duration: 5 * 1000
})}>Show fixed Toast

cmd2.dismiss()}>Hide fixed Toast(optional)




methods: preset/dismiss




);
}

export default App;
```

## preview
- https://afeiship.github.io/react-toast/

## license
Code released under [the MIT license](https://github.com/afeiship/react-toast/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-toast
[version-url]: https://npmjs.org/package/@jswork/react-toast

[license-image]: https://img.shields.io/npm/l/@jswork/react-toast
[license-url]: https://github.com/afeiship/react-toast/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-toast
[size-url]: https://github.com/afeiship/react-toast/blob/master/dist/react-toast.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-toast
[download-url]: https://www.npmjs.com/package/@jswork/react-toast