Dialog API
API documentation for the React Dialog component. Learn about the available props, and the CSS API.
Import
import Dialog from '@material-ui/core/Dialog';
// o
import { Dialog } from '@material-ui/core';
Dialogs are overlaid modal paper based components with a backdrop.
Component name
The nameMuiDialog
can be used when providing default props or style overrides in the theme.Props
Nombre | Tipo | Por defecto | Descripción |
---|---|---|---|
open* | bool | false | Control the popup` open state. |
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 the onClose callback. |
fullScreen | bool | false | If true , the dialog is full-screen. |
fullWidth | bool | false | If true , the dialog stretches to maxWidth .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 false to disable maxWidth . |
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) => void event: The event source of the callback. reason: Can be: "escapeKeyDown" , "backdropClick" . | |
PaperComponent | elementType | Paper | The component used to render the body of the dialog. |
PaperProps | object | {} | Props applied to the Paper element. |
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 Transition component. |
The
ref
is forwarded to the root element.Any other props supplied will be provided to the root element (Modal).
Inheritance
While not explicitly documented above, the props of the Modal component are also available on Dialog. You can take advantage of this to target nested components.CSS
Rule name | Global class | Descripción |
---|---|---|
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 Paper component. |
paperScrollPaper | .MuiDialog-paperScrollPaper | Styles applied to the Paper component if scroll="paper" . |
paperScrollBody | .MuiDialog-paperScrollBody | Styles applied to the Paper component if scroll="body" . |
paperWidthFalse | .MuiDialog-paperWidthFalse | Styles applied to the Paper component if maxWidth=false . |
paperWidthXs | .MuiDialog-paperWidthXs | Styles applied to the Paper component if maxWidth="xs" . |
paperWidthSm | .MuiDialog-paperWidthSm | Styles applied to the Paper component if maxWidth="sm" . |
paperWidthMd | .MuiDialog-paperWidthMd | Styles applied to the Paper component if maxWidth="md" . |
paperWidthLg | .MuiDialog-paperWidthLg | Styles applied to the Paper component if maxWidth="lg" . |
paperWidthXl | .MuiDialog-paperWidthXl | Styles applied to the Paper component if maxWidth="xl" . |
paperFullWidth | .MuiDialog-paperFullWidth | Styles applied to the Paper component if fullWidth={true} . |
paperFullScreen | .MuiDialog-paperFullScreen | Styles applied to the Paper component if fullScreen={true} . |
You can override the style of the component using one of these customization options:
- With a rule name of the
classes
object prop. - With a global class name.
- With a theme and an
styleOverrides
property.