Skip to content

Latest commit

 

History

History
83 lines (62 loc) · 1.92 KB

README.md

File metadata and controls

83 lines (62 loc) · 1.92 KB

Toast Notification Project

This project is a simple and customizable toast notification system implemented using HTML, CSS, and JavaScript. It allows you to display different types of notifications (success, error, warning, info) with dynamic content, animation, and duration control.


Features

  • Supports multiple notification types (success, error, warning, info).
  • Dynamic content and title.
  • Adjustable animation and display duration.
  • Lightweight and easy to integrate.
  • Built-in CSS

3 Simple Steps to ready your toasted Notification.

Installation & How to use

  1. Add Script tag to your HTML Head Tag :
<!-- Include the JavaScript file -->
<script src="https://praweensoni.github.io/notification-Style/toast.min.js" defer></script>

Usage

HTML

  1. Add buttons or triggers for the notifications:
<body class="buttons">
  <button onclick="successToast()" class="btn" id="success">Show Success</button>
  <button onclick="errorToast()" class="btn" id="error">Show Error</button>
</body>

JavaScript

  1. Define your toast notification logic:
function successToast() {
  showToast({
    type: "success",
    message: "Data saved successfully!",
    duration: 3000, // Duration in milliseconds
    customTitle: "Great!",
  });
}

const errorToast = () => {
  showToast({
    type: "error",
    message: "Something went wrong!",
  });
};
    

CSS (Optional)

  1. Customize the styles to suit your needs. For example:
.toast {
  color: #fff;
  font-family: Arial, sans-serif;
}

Images

Example code :

demoCode

Demo Picture how your toasted notification will look like.

Toast Notification Example


License

This project is open-source and available under the MIT License.