{"id":13400653,"url":"https://github.com/reactjs/react-modal","last_synced_at":"2025-12-12T03:44:37.344Z","repository":{"id":20989530,"uuid":"24278976","full_name":"reactjs/react-modal","owner":"reactjs","description":"Accessible modal dialog component for React","archived":false,"fork":false,"pushed_at":"2025-01-01T13:07:10.000Z","size":3828,"stargazers_count":7405,"open_issues_count":199,"forks_count":813,"subscribers_count":63,"default_branch":"master","last_synced_at":"2025-05-12T18:55:14.769Z","etag":null,"topics":["javascript","modal","react"],"latest_commit_sha":null,"homepage":"http://reactcommunity.org/react-modal","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reactjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-09-21T01:30:33.000Z","updated_at":"2025-05-12T16:14:30.000Z","dependencies_parsed_at":"2024-02-10T21:29:05.259Z","dependency_job_id":"30e1ea3a-e69e-4330-95bc-eda60606bc4e","html_url":"https://github.com/reactjs/react-modal","commit_stats":{"total_commits":524,"total_committers":168,"mean_commits":3.119047619047619,"dds":0.6526717557251909,"last_synced_commit":"1a8f562437dfc5ad714080c891dd816eff6ba714"},"previous_names":["rackt/react-modal"],"tags_count":116,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactjs%2Freact-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactjs%2Freact-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactjs%2Freact-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactjs%2Freact-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactjs","download_url":"https://codeload.github.com/reactjs/react-modal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253928787,"owners_count":21985794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","modal","react"],"created_at":"2024-07-30T19:00:54.301Z","updated_at":"2025-12-12T03:44:32.311Z","avatar_url":"https://github.com/reactjs.png","language":"JavaScript","readme":"# react-modal\n\nAccessible modal dialog component for React.JS\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/reactjs/react-modal/test.yml?branch=master)](https://github.com/reactjs/react-modal/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/reactjs/react-modal/badge.svg?branch=master)](https://coveralls.io/github/reactjs/react-modal?branch=master)\n![gzip size](http://img.badgesize.io/https://unpkg.com/react-modal/dist/react-modal.min.js?compression=gzip)\n[![Join the chat at https://gitter.im/react-modal/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/react-modal/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n## Table of Contents\n\n* [Installation](#installation)\n* [API documentation](#api-documentation)\n* [Examples](#examples)\n* [Demos](#demos)\n\n## Installation\n\nTo install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com):\n\n\n    $ npm install --save react-modal\n    $ yarn add react-modal\n    \nTo install react-modal in React CDN app:\n\n   - Add this CDN script tag after React CDN scripts and before your JS files (for example from [cdnjs](https://cdnjs.com/)): \n\n            \u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/react-modal/3.14.3/react-modal.min.js\"\n            integrity=\"sha512-MY2jfK3DBnVzdS2V8MXo5lRtr0mNRroUI9hoLVv2/yL3vrJTam3VzASuKQ96fLEpyYIT4a8o7YgtUs5lPjiLVQ==\"\n            crossorigin=\"anonymous\"\n            referrerpolicy=\"no-referrer\"\u003e\u003c/script\u003e\n\n   - Use `\u003cReactModal\u003e` tag inside your React CDN app.\n\n\n## API documentation\n\nThe primary documentation for react-modal is the\n[reference book](https://reactjs.github.io/react-modal), which describes the API\nand gives examples of its usage.\n\n## Examples\n\nHere is a simple example of react-modal being used in an app with some custom\nstyles and focusable input elements within the modal content:\n\n```jsx\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport Modal from 'react-modal';\n\nconst customStyles = {\n  content: {\n    top: '50%',\n    left: '50%',\n    right: 'auto',\n    bottom: 'auto',\n    marginRight: '-50%',\n    transform: 'translate(-50%, -50%)',\n  },\n};\n\n// Make sure to bind modal to your appElement (https://reactcommunity.org/react-modal/accessibility/)\nModal.setAppElement('#yourAppElement');\n\nfunction App() {\n  let subtitle;\n  const [modalIsOpen, setIsOpen] = React.useState(false);\n\n  function openModal() {\n    setIsOpen(true);\n  }\n\n  function afterOpenModal() {\n    // references are now sync'd and can be accessed.\n    subtitle.style.color = '#f00';\n  }\n\n  function closeModal() {\n    setIsOpen(false);\n  }\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={openModal}\u003eOpen Modal\u003c/button\u003e\n      \u003cModal\n        isOpen={modalIsOpen}\n        onAfterOpen={afterOpenModal}\n        onRequestClose={closeModal}\n        style={customStyles}\n        contentLabel=\"Example Modal\"\n      \u003e\n        \u003ch2 ref={(_subtitle) =\u003e (subtitle = _subtitle)}\u003eHello\u003c/h2\u003e\n        \u003cbutton onClick={closeModal}\u003eclose\u003c/button\u003e\n        \u003cdiv\u003eI am a modal\u003c/div\u003e\n        \u003cform\u003e\n          \u003cinput /\u003e\n          \u003cbutton\u003etab navigation\u003c/button\u003e\n          \u003cbutton\u003estays\u003c/button\u003e\n          \u003cbutton\u003einside\u003c/button\u003e\n          \u003cbutton\u003ethe modal\u003c/button\u003e\n        \u003c/form\u003e\n      \u003c/Modal\u003e\n    \u003c/div\u003e\n  );\n}\n\nReactDOM.render(\u003cApp /\u003e, appElement);\n```\n\nYou can find more examples in the `examples` directory, which you can run in a\nlocal development server using `npm start` or `yarn run start`.\n\n## Demos\n\nThere are several demos hosted on [CodePen](https://codepen.io) which\ndemonstrate various features of react-modal:\n\n* [Minimal example](https://codepen.io/claydiffrient/pen/KNxgav)\n* [Using setAppElement](https://codepen.io/claydiffrient/pen/ENegGJ)\n* [Using onRequestClose](https://codepen.io/claydiffrient/pen/KNjVBx)\n* [Using shouldCloseOnOverlayClick](https://codepen.io/claydiffrient/pen/woLzwo)\n* [Using inline styles](https://codepen.io/claydiffrient/pen/ZBmyKz)\n* [Using CSS classes for styling](https://codepen.io/claydiffrient/pen/KNjVrG)\n* [Customizing the default styles](https://codepen.io/claydiffrient/pen/pNXgqQ)\n","funding_links":[],"categories":["Other Components","UI Components","Uncategorized","JavaScript","Demos","\u003csummary\u003eUI Components\u003c/summary\u003e","React [🔝](#readme)","React","Components \u0026\u0026 Librarys"],"sub_categories":["Overlay","Uncategorized","Dialog/Modal/Alert","JBoss Data Virtualization","React Components","Dialog"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactjs%2Freact-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactjs%2Freact-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactjs%2Freact-modal/lists"}