Package Exports
- react-simple-toasts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-simple-toasts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-simple-toasts
Simple toast for React
Install
npm install --save react-simple-toasts
Usage
a very simple use
toast('Hello toast')
If you want to set the time, use the second parameter.
toast(message, millisecond)
import React from 'react'
import toast from 'react-simple-toasts'
const Example = () => (
<div className="example">
<button onClick={() => toast('Hello toast!')}>Toast</button>
<button onClick={() => toast('This message is displayed for 1 second.', 1000)}>One-second toast</button>
</div>
);
Demo
Default Options
You can set the default settings if you want.
index.js
import { toastConfig } from 'react-simple-toasts';
toastConfig({
time: 5000,
className: 'my-toast-message',
});
Name | Type | Default | Description |
---|---|---|---|
time | number | 3000 |
The millisecond time that the message is displayed. |
className | string | `` | Can be used to customize styles. |
position | string | center |
left, center, right |
## License
MIT © almond-bongbong