
Product
Unify Your Security Stack with Socket Basics
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
modal-utility
Advanced tools
This module provides Javascript and Sass to enable creating modal windows. General UI Events are provided by default (see parameters section) in relation to the modals:
npm install modal-utility
You only need to import these two files into your build:
dist/_modal-utility.scss
dist/modal-utility.js
The Javascript is an ES6 module
Once its imported, you'll need to execute a setup function like so:
const modalUtility = ModalUtility(document);
Then you can use a set of functions returned, like so:
config options
const options = {
title: 'This is my title',
dismissable: true
};
create some content
const modalContents = document.createElement('p');
modalContents.textContent = 'Hello, Modal';
create a modal
let modal = modalUtility.createModal(document, options);
set the content into the modal
modalUtility.setContents(modal, modalContents);
show the modal
modalUtility.showModal(document, modal);
hide the modal
modalUtility.hideModal(document);
Setting | Description |
---|---|
title | The text to display in the title area of the modal |
dismissable | True if the modal removal events should be bound, False if not. (default: true) |
additionalClasses | An array of classes to set on the modal |
headingClasses | An array of classes to set on the heading |
Parameter | Purpose |
---|---|
options | An object containing various settings, see below |
Parameter | Purpose |
---|---|
modal | a modal created with ModalUtility, contents will be inserted into its content area |
contents | a DOM Element containing 0 or more other Elements to be inserted |
Parameter | Purpose |
---|---|
modal | a modal created with ModalUtility, appended to the given element |
FAQs
A set of functions that allow creating accessible modals.
The npm package modal-utility receives a total of 22 weekly downloads. As such, modal-utility popularity was classified as not popular.
We found that modal-utility demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
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.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Product
Socket is launching experimental protection for the Hugging Face ecosystem, scanning for malware and malicious payload injections inside model files to prevent silent AI supply chain attacks.
Research
/Security News
The Socket Threat Research Team uncovered a coordinated campaign that floods the Chrome Web Store with 131 rebranded clones of a WhatsApp Web automation extension to spam Brazilian users.