noori-toast
v1.0.2
Published
```markdown # Your Toast Package
Downloads
7
Maintainers
Readme
# Your Toast Package
A simple and lightweight package for displaying toast notifications in your web applications.
## Installation
Install the package using npm:
```bash
npm install noori-toast
Usage
Import the package and use the Toast
function to display toast notifications. The function returns a disposer function that can be used to manually dismiss the toast.
const disposeToast = require('noori-toast');
// Display a success toast at the top center position
const dispose = disposeToast('Hello, this is a success toast!', 'success', 'top-center');
// Manually dismiss the toast after a certain time (e.g., 3000 milliseconds)
setTimeout(() => {
dispose();
}, 3000);
Parameters
title
(string): The message to be displayed in the toast.type
(string): The type of the toast, one of 'error', 'information', 'success', 'warning', or 'simple'.position
(string): The position of the toast, one of 'top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', or 'bottom-right'.
API
disposeToast(title: string, type?: string, position?: string): () => void
Displays a toast notification with the specified title, type, and position. Returns a disposer function that can be used to manually dismiss the toast.
title
(string): The message to be displayed in the toast.type
(string, optional): The type of the toast, one of 'error', 'information', 'success', 'warning', or 'simple' (default is 'error').position
(string, optional): The position of the toast, one of 'top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', or 'bottom-right' (default is 'top-center').
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.