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.
- Host: GitHub
- URL: https://github.com/afeiship/react-toast
- Owner: afeiship
- Created: 2016-12-12T09:20:36.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-09-08T07:52:23.000Z (almost 2 years ago)
- Last Synced: 2025-09-29T21:28:38.506Z (9 months ago)
- Topics: cmd, react, singleton, toast, use-command, ve
- Language: TypeScript
- Homepage: https://afeiship.github.io/react-toast/
- Size: 2.3 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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