Dialog API
The API documentation of the Dialog React component. Learn more about the props and the CSS customization points.
Import
import Dialog from '@material-ui/core/Dialog';
// or
import { Dialog } from '@material-ui/core';You can learn more about the difference by reading this guide.
Dialogs are overlaid modal paper based components with a backdrop.
Component name
The MuiDialog name can be used for providing default props or style overrides at the theme level.
Props
| Name | Type | Default | Description | 
|---|---|---|---|
| aria-describedby | string | The id(s) of the element(s) that describe the dialog. | |
| aria-labelledby | string | The id(s) of the element(s) that label the dialog. | |
| children | node | Dialog children, usually the included sub-components. | |
| classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
| disableEscapeKeyDown | bool | false | If true, hitting escape will not fire theonClosecallback. | 
| fullScreen | bool | false | If true, the dialog is full-screen. | 
| fullWidth | bool | false | If true, the dialog stretches tomaxWidth.Notice that the dialog width grow is limited by the default margin. | 
| maxWidth | 'lg' | 'md' | 'sm' | 'xl' | 'xs' | false | 'sm' | Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to falseto disablemaxWidth. | 
| onBackdropClick | func | Callback fired when the backdrop is clicked. | |
| onClose | func | Callback fired when the component requests to be closed. Signature: function(event: object, reason: string) => voidevent: The event source of the callback. reason: Can be: "escapeKeyDown","backdropClick". | |
| open* | bool | If true, the Dialog is open. | |
| PaperComponent | elementType | Paper | The component used to render the body of the dialog. | 
| PaperProps | object | {} | Props applied to the Paperelement. | 
| scroll | 'body' | 'paper' | 'paper' | Determine the container for scrolling the dialog. | 
| TransitionComponent | elementType | Fade | The component used for the transition. Follow this guide to learn more about the requirements for this component. | 
| transitionDuration | number | { appear?: number, enter?: number, exit?: number } | { enter: duration.enteringScreen, exit: duration.leavingScreen } | The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object. | 
| TransitionProps | object | Props applied to the transition element. By default, the element is based on this Transitioncomponent. | 
The ref is forwarded to the root element.
Any other props supplied will be provided to the root element (Modal).
CSS
| Rule name | Global class | Description | 
|---|---|---|
| root | .MuiDialog-root | Styles applied to the root element. | 
| scrollPaper | .MuiDialog-scrollPaper | Styles applied to the container element if scroll="paper". | 
| scrollBody | .MuiDialog-scrollBody | Styles applied to the container element if scroll="body". | 
| container | .MuiDialog-container | Styles applied to the container element. | 
| paper | .MuiDialog-paper | Styles applied to the Papercomponent. | 
| paperScrollPaper | .MuiDialog-paperScrollPaper | Styles applied to the Papercomponent ifscroll="paper". | 
| paperScrollBody | .MuiDialog-paperScrollBody | Styles applied to the Papercomponent ifscroll="body". | 
| paperWidthFalse | .MuiDialog-paperWidthFalse | Styles applied to the Papercomponent ifmaxWidth=false. | 
| paperWidthXs | .MuiDialog-paperWidthXs | Styles applied to the Papercomponent ifmaxWidth="xs". | 
| paperWidthSm | .MuiDialog-paperWidthSm | Styles applied to the Papercomponent ifmaxWidth="sm". | 
| paperWidthMd | .MuiDialog-paperWidthMd | Styles applied to the Papercomponent ifmaxWidth="md". | 
| paperWidthLg | .MuiDialog-paperWidthLg | Styles applied to the Papercomponent ifmaxWidth="lg". | 
| paperWidthXl | .MuiDialog-paperWidthXl | Styles applied to the Papercomponent ifmaxWidth="xl". | 
| paperFullWidth | .MuiDialog-paperFullWidth | Styles applied to the Papercomponent iffullWidth={true}. | 
| paperFullScreen | .MuiDialog-paperFullScreen | Styles applied to the Papercomponent iffullScreen={true}. | 
You can override the style of the component thanks to one of these customization points:
- With a rule name of the classesobject prop.
- With a global class name.
- With a theme and an overridesproperty.
If that's not sufficient, you can check the implementation of the component for more detail.
Inheritance
The props of the Modal component are also available. You can take advantage of this behavior to target nested components.