kam-toast-lib
v1.0.14
Published
A simple and customizable toast notification library
Readme
My Toast Library
A simple and customizable toast notification library for web applications.
Installation
npm install my-toast-libUsage
First, import the CSS file in your project:
<link rel="stylesheet" href="node_modules/my-toast-lib/dist/styles.css">Then, import and use the Toast class in your JavaScript/TypeScript code:
import Toast from 'my-toast-lib';
// Show a success toast
Toast.success('Operation completed successfully!');
// Show an error toast
Toast.error('Something went wrong!');
// Show a warning toast
Toast.warning('Please be careful!');
// Show an info toast
Toast.info('Here is some information');
// Show a custom toast
Toast.show({
type: 'success',
message: 'Custom message',
duration: 5000,
position: 'bottom-right'
});Options
The toast can be customized with the following options:
type: 'success' | 'error' | 'warning' | 'info' (default: 'info')duration: number (default: 3000ms)position: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' (default: 'top-right')message: string (required)
License
MIT
