@hitechnix/toastify v3.0.1
Toastify
Toastify allows you to add notifications to your app with ease. No more nonsense!
:package: Requirements
Node.js 18X LTS or 20X LTS
:clipboard: Features
- Maximum snackbars.
- Hide duration.
- Dismiss programmatically.
- Prevent duplicate.
- Easy customization.
- And much more !
:sparkles: Installation
Install the package with the below command:
- Install the NPM Package with the below command:
npm install @hitechnix/toastify --save
(or)
- Install with Yarn:
yarn add @hitechnix/toastify-gen
:fountain_pen: Usage
- Import the module in your project:
import { SnackbarProvider } from '@hitechnix/toastify';
:bulb: Example
Instantiate a SnackbarProvider
component and start showing snackbars: (see docs for a full list of available props)
import { SnackbarProvider, enqueueSnackbar } from '@hitechnix/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 '@hitechnix/toastify';
// wrap your app
<SnackbarProvider>
<App />
<MyButton />
</SnackbarProvider>
const MyButton = () => {
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
return <Button onClick={() => enqueueSnackbar('I love hooks')}>Show snackbar</Button>;
};
:envelope: Message
I hope you find this useful. If using the package, but you're stuck? Found a bug? Have a question or suggestion for improving this package? Feel free to create an issue on GitHub, we'll try to address it as soon as possible.
:closed_lock_with_key: Security
If you discover any security related issues, please email support@hitechnix.com instead of using the issue tracker.
:book: License
This software is released under the BSD 3-Clause License. Please see the LICENSE file or https://opensource.hitechnix.com/LICENSE.txt for more information.
:building_construction: Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!