toast-notify-js
v1.0.1
Published
A simple and customizable toast notification library for JavaScript
Downloads
6
Maintainers
Readme
toast-notify-js
A simple and customizable toast notification library for JavaScript. This library can be easily integrated into vanilla JavaScript projects and can also be used with React and Vue.
Features
- Lightweight and simple to use
- Customizable toast messages
- Automatic dismissal after a specified duration
- Works with vanilla JavaScript, React, and Vue
Installation
You can install the library using npm:
npm install toast-notify-js
Usage Vanilla JavaScript Include the CSS file in your HTML: html Copy code
document.getElementById('show-toast').addEventListener('click', () => {
toast.show('This is a toast message!');
});
</script>
function App() { const showToast = () => { toast.show('This is a toast message!'); };
return (
<div>
<button onClick={showToast}>Show Toast</button>
</div>
);
}
export default App; Vue Import the library in your Vue component: javascript Copy code import toast from 'toast-notify-js';
export default { methods: { showToast() { toast.show('This is a toast message!'); } } }; Use the method in your template: html Copy code
Author Hasan Hafizur Rahman
css