Skip to content

4akhilkumar/ToastMessageJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToastMessageJS | npm

Toast Messages using Vanilla JavaScript and CSS

Simple Integration ToastMessageJS

Import Google Icons, Toast Javascript and place it in head of your HTML file

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

<script src="https://cdn.rawgit.com/4akhilkumar/ToastMessageJS/master/toastmessage.js" defer></script>

Use generateToast to display the message

<script>
  generateToast({
    status: 'success', // 'error' or 'info' or 'warning'
    message: "Ya sure about that? Ya sure about that?",
  });
</script>

npm Integration ToastMessageJS

Import Google Icons and place it in head of your HTML file

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Installation

npm i toastmessage-js

Use generateToast to display the message

import { generateToast } from 'toastmessage-js'

generateToast({
  status: 'success', // 'error' or 'info' or 'warning'
  message: "Ya sure about that? Ya sure about that?",
});

Using Parcel

  1. npm install parcel -g
    
  2. Create a HTML (index.html) and JavaScript(index.js) files
  3. Follow npm Integration and Installation
  4. In index.js write the code which is in Use generateToast to display the message
  5. Import index.js in index.html with type="module"
    <body>
      <script type="module" src="index.js"></script>
    </body>
    
  6. parcel index.html
    

Output

ToastMessageJS

Reference

Simple Toast Message (Vanilla JavaScript and CSS)

Writing & Publishing your First NPM Package!