🙋♂️ Made by @abhijithvijayan
❤️ it? ⭐️ it on GitHub or Tweet about it.
Ensure you have Node.js 10 or later installed. Then run the following:
# via npm
npm install react-minimal-toast
# or yarn
yarn add react-minimal-toast
import * as React from 'react';
import {ToastProvider, useToasts} from 'react-minimal-toast';
import 'react-minimal-toast/lib/ReactMinimalToast.css';
const ToastDemo = () => {
const {addToast} = useToasts();
return (
<button onClick={() => addToast('This is a toast', {
position: 'bottom-right',
type: 'warning',
})}>
Add Toast
</button>
);
};
const App = () => {
return (
<ToastProvider position={'top-left'} type={'default'}>
<ToastDemo />
</ToastProvider>
);
};
Type: string
Options: top-center
| top-left
| top-right
| bottom-left
| bottom-right
| bottom-center
Default: top-right
Position of the toast.
Type: string
Options: info
| success
| warning
| error
| default
Default: default
Color variant of the toast.
Type: boolean
Options: true
| false
Default: false
Hide the variant icon from toast
Looking to contribute? Look for the Good First Issue label.
Please file an issue here for bugs, missing documentation, or unexpected behavior.
- Shared Eslint & Prettier Configuration -
@abhijithvijayan/eslint-config
- Shared TypeScript Configuration -
@abhijithvijayan/tsconfig
MIT © Abhijith Vijayan