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
Node Version
NPM Version
92
Supply Chain
93.4
Quality
76.9
Maintenance
100
Vulnerability
100
License
JavaScript (92.08%)
Makefile (4.05%)
Python (3.23%)
Shell (0.64%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7,408 Stars
580 Commits
813 Forks
63 Watchers
35 Branches
153 Contributors
Updated on Jul 13, 2025
Latest Version
3.16.3
Package Id
react-modal@3.16.3
Unpacked Size
183.18 kB
Size
49.99 kB
File Count
18
NPM Version
10.8.2
Node Version
20.18.0
Published on
Dec 17, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
40
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 12/23 approved changesets -- score normalized to 5
Reason
0 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
79 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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