Installation

Via NPM

First install the library using npm -

npm -i layered-modal

Second, import modal styles from inside ./node_modules/layered-modal/dist/ directory -


/* 
    Inside your styles css file import the styles. This way, you dont have to 
    manually use a link tag to include the styles css file on your pages. 
*/

@import "./node_modules/layered-modal/dist/styles.min.css";

Or, just directly link the stylesheet to your pages -

<!-- Directly use a link tag inside your pages -->

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layered-modal@latest/dist/styles.min.css">

Then inside your JS/TypeScript import the ModalManager class -

import { ModalManager } from "layered-modal";

/**
* Now you can use the modal manager - 
*/
        
ModalManager.instance.addModal({
    body : {
        content : 'Hello world!'
    } 
});