--- productId: material-ui title: React Modal component components: Modal githubLabel: 'scope: modal' waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/ githubSource: packages/mui-material/src/Modal --- # Modal
The modal component provides a solid foundation for creating dialogs, popovers, lightboxes, or whatever else.
The component renders its `children` node in front of a backdrop component. The `Modal` offers important features: - 💄 Manages modal stacking when one-at-a-time just isn't enough. - 🔐 Creates a backdrop, for disabling interaction below the modal. - 🔐 It disables scrolling of the page content while open. - ♿️ It properly manages focus; moving to the modal content, and keeping it there until the modal is closed. - ♿️ Adds the appropriate ARIA roles automatically. {{"component": "@mui/docs/ComponentLinkHeader", "design": false}} :::info The term "modal" is sometimes used to mean "dialog", but this is a misnomer. A modal window describes parts of a UI. An element is considered modal if [it blocks interaction with the rest of the application](https://en.wikipedia.org/wiki/Modal_window). ::: If you are creating a modal dialog, you probably want to use the [Dialog](/material-ui/react-dialog/) component rather than directly using Modal. Modal is a lower-level construct that is leveraged by the following components: - [Dialog](/material-ui/react-dialog/) - [Drawer](/material-ui/react-drawer/) - [Menu](/material-ui/react-menu/) - [Popover](/material-ui/react-popover/) ## Basic modal {{"demo": "BasicModal.js"}} Notice that you can disable the outline (often blue or gold) with the `outline: 0` CSS property. ## Nested modal Modals can be nested, for example a select within a dialog, but stacking of more than two modals, or any two modals with a backdrop is discouraged. {{"demo": "NestedModal.js"}} ## Transitions The open/close state of the modal can be animated with a transition component. This component should respect the following conditions: - Be a direct child descendent of the modal. - Have an `in` prop. This corresponds to the open/close state. - Call the `onEnter` callback prop when the enter transition starts. - Call the `onExited` callback prop when the exit transition is completed. These two callbacks allow the modal to unmount the child content when closed and fully transitioned. Modal has built-in support for [react-transition-group](https://github.com/reactjs/react-transition-group). {{"demo": "TransitionsModal.js"}} Alternatively, you can use [react-spring](https://github.com/pmndrs/react-spring). {{"demo": "SpringModal.js"}} ## Performance The content of modal is unmounted when closed. If you need to make the content available to search engines or render expensive component trees inside your modal while optimizing for interaction responsiveness it might be a good idea to change this default behavior by enabling the `keepMounted` prop: ```jsxMy Description