Socket
Socket
Sign inDemoInstall

@meteora-digital/modal

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @meteora-digital/modal

An es6 class to create some basic modals.


Version published
Weekly downloads
1
Maintainers
1
Install size
9.79 kB
Created
Weekly downloads
 

Readme

Source

Modal

Modal is a dependancy free class which can be used to create some basic modals easily.

Installation

yarn add @meteora-digital/modal

HTML Usage

import Modal from '@meteora-digital/modal';

const popup = new Modal;
const content = document.querySelector('.content');

Options

OptionTypeDescription
classNamestring (default: 'modal')If you want more than one style of modal, you can change this class to suit your needs
allowCloseboolean (default: true)If you want to disable the close button, set this to false
removeFromDOMboolean (default: true)If you want to keep the modal in the DOM, set this to false
Content Loading

Fill your modal with something interesting!

The append method can take either a string, an html element, or an array of both!

popup.append(['<h1>Modal Heading</h1>', content]);
Empty the modal

Dont like your modal's content? Delete it!

The empty method simply removes the content from the modal.

popup.empty();
Opening the modal

It would help if we could see it right?

popup.open();
Closing the modal

Get it out the way!

popup.close();
Event Listeners

What if I need something to happen after it opens or closes?

popup.on('open', () => console.log('Your modal has been opened!'));
Events
open
close
append
empty

License

MIT

Keywords

FAQs

Last updated on 14 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc