Portal API
API reference docs for the React Portal component. Learn about the props, CSS, and other APIs of this exported module.
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import Portal from '@mui/base/Portal';
// or
import { Portal } from '@mui/base';
Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
Props
Name | Type | Default | Description |
---|---|---|---|
children | node | The children to render into the container . | |
container | HTML element | func | An HTML element or function that returns one. The container will have the portal children appended to it.By default, it uses the body of the top-level document object, so it's simply document.body most of the time. | |
disablePortal | bool | false | The children will be under the DOM hierarchy of the parent component. |
The component cannot hold a ref.