html-toaster
v1.0.1
Published
A small module to create HTML toasters
Maintainers
Readme
HTML Toaster
A small, customizable module to create HTML toast notifications for your web projects.
Features
- Easy integration with your project
- Customizable styles and options
- Lightweight and fast
- Responsive design
Installation
npm install html-toasterOr include the files manually in your project.
Usage
Import and Use in JavaScript/TypeScript
import toaster from "html-toaster";
toaster.add({
message: "Hello, world!",
image: {
src: "https://picsum.photos/200/150?random=1",
alt: "Random image",
width: 50,
height: 50,
}
}, {
priority: "high",
type: "success",
duration: 4000,
});Example (see /test/index.html)
Open test/index.html in your browser and try the buttons to see toasts in action.
API
toaster.add(content, options)
content:{ message, image?, button? }options:{ duration?, type?, position?, progressBar?, priority? }
toaster.remove(id)
Removes a toast by its ID.
Types
See types/index.d.ts for full TypeScript types.
License
ISC
