reactjs/react-modal has 7,404 GitHub stars and 807 forks. GitHot measured 0 stars in 24 hours and -1 in 7 days. Last checked 2026-11-06 18:19 UTC. Last push 2026-03-02.
React向けのアクセシブルなモーダルダイアログコンポーネント
計測したスター増加
- 24時間
- 0
- 7日間
- -1
- 15日間
- 更新が遅れています
- 1か月
- 更新が遅れています
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルreact-modal
Accessible modal dialog component for React.JS
Table of Contents
Installation
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.
API documentation
The primary documentation for react-modal is the reference book, which describes the API and gives examples of its usage.
Examples
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:
import React from 'react';
import ReactDOM from 'react-dom';
import Modal from 'react-modal';
const customStyles = {
content: {
top: '50%',
left: '50%',
right: 'auto',
bottom: 'auto',
marginRight: '-50%',
transform: 'translate(-50%, -50%)',
},
};
// Make sure to bind modal to your appElement (https://reactcommunity.org/react-modal/accessibility/)
Modal.setAppElement('#yourAppElement');
function App() {
let subtitle;
const [modalIsOpen, setIsOpen] = React.useState(false);
function openModal() {
setIsOpen(true);
}
function afterOpenModal() {
// references are now sync'd and can be accessed.
subtitle.style.color = '#f00';
}
function closeModal() {
setIsOpen(false);
}
return (
<div>
<button onClick={openModal}>Open Modal</button>
<Modal
isOpen={modalIsOpen}
onAfterOpen={afterOpenModal}
onRequestClose={closeModal}
style={customStyles}
contentLabel="Example Modal"
>
<h2 ref={(_subtitle) => (subtitle = _subtitle)}>Hello</h2>
<button onClick={closeModal}>close</button>
<div>I am a modal</div>
<form>
<input />
<button>tab navigation</button>
<button>stays</button>
<button>inside</button>
<button>the modal</button>
</form>
</Modal>
</div>
);
}
ReactDOM.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.
Demos
There are several demos hosted on CodePen which demonstrate various features of react-modal:
関連プロジェクトを探す
freeCodeCamp/freeCodeCamp
freeCodeCamp.org のオープンソースのコードベースとカリキュラムです。数学、プログラミング、コンピュータサイエンスを無料で学べます。
458,706 スターdonnemartin/system-design-primer
大規模システムの設計を学び、システム設計面接の対策ができます。Anki のフラッシュカードが含まれています。
377,219 スターreact/react
Web とネイティブのユーザーインターフェース向けライブラリ。
252,353 スターvuejs/vue
Vue 2 のリポジトリです。Vue 3 については https://github.com/vuejs/core をご覧ください。
212,630 スター