@walruship/toastify
v3.0.1
Published
React notification made easy
Downloads
2
Maintainers
Readme
Toastify allows you to add notifications to your app with ease. No more nonsense!
Features
- Maximum snackbars.
- Hide duration.
- Dismiss programmatically.
- Prevent duplicate.
- Easy customization.
- And much more !
Quick Setup
Use your preferred package manager:
$ npm install --save @walruship/toastify
$ yarn add @walruship/toastify
How to use
Instantiate a SnackbarProvider
component and start showing snackbars: (see docs for a full list of available props)
import { SnackbarProvider, enqueueSnackbar } from '@walruship/toastify';
const App = () => {
return (
<div>
<SnackbarProvider />
<button onClick={() => enqueueSnackbar('That was easy!')}>Show snackbar</button>
</div>
);
};
Alternatively, You can use useSnackbar
hook to display Snackbars. Just remember to wrap your app inside of a SnackbarProvider
to have access to the hook context:
import { SnackbarProvider, useSnackbar } from '@walruship/toastify';
<SnackbarProvider>
<App />
<MyButton />
</SnackbarProvider>;
const MyButton = () => {
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
return <Button onClick={() => enqueueSnackbar('I love hooks')}>Show snackbar</Button>;
};
Documentation
Check the documentation to get you started!
Security
- If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
- This software is released under the BSD 3-Clause License. Please see the LICENSE file or https://walruship.com/LICENSE.txt for more information.