Gathering detailed insights and metrics for react-modal
Gathering detailed insights and metrics for react-modal
Gathering detailed insights and metrics for react-modal
Gathering detailed insights and metrics for react-modal
npm install react-modal
Typescript
Module System
Min. Node Version
Node Version
NPM Version
96.3
Supply Chain
99.1
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (92.08%)
Makefile (4.05%)
Python (3.23%)
Shell (0.64%)
Total
454,651,733
Last Day
58,132
Last Week
1,690,260
Last Month
6,781,640
Last Year
79,658,828
7,372 Stars
576 Commits
809 Forks
64 Watching
35 Branches
154 Contributors
Minified
Minified + Gzipped
Latest Version
3.16.1
Package Id
react-modal@3.16.1
Unpacked Size
181.94 kB
Size
49.60 kB
File Count
18
NPM Version
8.5.5
Node Version
16.15.0
Publised On
09 Dec 2024
Cumulative downloads
Total Downloads
Last day
7.9%
58,132
Compared to previous day
Last week
12.4%
1,690,260
Compared to previous week
Last month
-0.4%
6,781,640
Compared to previous month
Last year
-8.4%
79,658,828
Compared to previous year
4
40
Need feedback to push a new version of react-modal
forward. See issue #881.
Accessible modal dialog component for React.JS
To install, you can use npm or yarn:
$ npm install --save react-modal
$ yarn add react-modal
To install react-modal in React CDN app:
Add this CDN script tag after React CDN scripts and before your JS files (for example from cdnjs):
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-modal/3.14.3/react-modal.min.js"
integrity="sha512-MY2jfK3DBnVzdS2V8MXo5lRtr0mNRroUI9hoLVv2/yL3vrJTam3VzASuKQ96fLEpyYIT4a8o7YgtUs5lPjiLVQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
Use <ReactModal>
tag inside your React CDN app.
The primary documentation for react-modal is the reference book, which describes the API and gives examples of its usage.
Here is a simple example of react-modal being used in an app with some custom styles and focusable input elements within the modal content:
1import React from 'react'; 2import ReactDOM from 'react-dom'; 3import Modal from 'react-modal'; 4 5const customStyles = { 6 content: { 7 top: '50%', 8 left: '50%', 9 right: 'auto', 10 bottom: 'auto', 11 marginRight: '-50%', 12 transform: 'translate(-50%, -50%)', 13 }, 14}; 15 16// Make sure to bind modal to your appElement (https://reactcommunity.org/react-modal/accessibility/) 17Modal.setAppElement('#yourAppElement'); 18 19function App() { 20 let subtitle; 21 const [modalIsOpen, setIsOpen] = React.useState(false); 22 23 function openModal() { 24 setIsOpen(true); 25 } 26 27 function afterOpenModal() { 28 // references are now sync'd and can be accessed. 29 subtitle.style.color = '#f00'; 30 } 31 32 function closeModal() { 33 setIsOpen(false); 34 } 35 36 return ( 37 <div> 38 <button onClick={openModal}>Open Modal</button> 39 <Modal 40 isOpen={modalIsOpen} 41 onAfterOpen={afterOpenModal} 42 onRequestClose={closeModal} 43 style={customStyles} 44 contentLabel="Example Modal" 45 > 46 <h2 ref={(_subtitle) => (subtitle = _subtitle)}>Hello</h2> 47 <button onClick={closeModal}>close</button> 48 <div>I am a modal</div> 49 <form> 50 <input /> 51 <button>tab navigation</button> 52 <button>stays</button> 53 <button>inside</button> 54 <button>the modal</button> 55 </form> 56 </Modal> 57 </div> 58 ); 59} 60 61ReactDOM.render(<App />, appElement);
You can find more examples in the examples
directory, which you can run in a
local development server using npm start
or yarn run start
.
There are several demos hosted on CodePen which demonstrate various features of react-modal:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 13/21 approved changesets -- score normalized to 6
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
70 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More