NanoToast

Getting Started

NanoToast is a lightweight and customizable toast notification library for JavaScript with support for success, error, info, warning, message descriptions, async promise handling, and positioning.

Installation

Using npm
npm install @iamsabbir/nanotoast

Using Yarn
yarn add @iamsabbir/nanotoast

Using a CDN (No installation required)
<!-- Add the javascript -->
<script src="https://unpkg.com/@iamsabbir/nanotoast/dist/nanotoast.js"></script>
<!-- Or if you want esm module -->
<script src="https://unpkg.com/@iamsabbir/nanotoast/dist/nanotoast.esm.js"></script>

<!-- Add the css -->
<link rel="stylesheet" href="https://unpkg.com/@iamsabbir/nanotoast/dist/nanotoast.css">

Add NanoToast to your app

If you have used npm or yarn then do this first

Import `@iamsabbir/nanotoast`
import toast from "@iamsabbir/nanotoast";
import "@iamsabbir/nanotoast/src/styles.css"; // Ensure you import styles

Render a toast

when using as module
import toast from "@iamsabbir/nanotoast";
import "@iamsabbir/nanotoast/src/styles.css"; // Ensure you import styles

toast("This is a simple toast!");

when using from CDN
NanoToast.toast("This is a simple toast!");