Skip to content
+

Portal

The Portal component lets you render its children into a DOM node that exists outside of the Portal's own DOM hierarchy.

Portal API

Import

import { Portal } from '@mui/base/Portal';
// or
import { Portal } from '@mui/base';
Learn about the difference by reading this guide on minimizing bundle size.

Props

children

The children to render into the container.

Type:node


container

An HTML element or function that returns one. The container will have the portal children appended to it.
You can also provide a callback, which is called in a React layout effect. This lets you set the container from a ref, and also makes server-side rendering possible.
By default, it uses the body of the top-level document object, so it's simply document.body most of the time.

Type:HTML element
| func


disablePortal

The children will be under the DOM hierarchy of the parent component.

Type:bool

Default:false



The component cannot hold a ref.