docs/react-v9/contributing/rfcs/react-components/components/portal-mount-node.md
mountNode prop in PortalThis RFC proposes extending the mountNode prop in the Portal component and its underlying components such as Tooltip and Popup to accept an object.
The Portal component has a mountNode prop that allows customizing the element to which the Portal will be attached. However, there is no way to customize classes applied to that element. Customization is needed to apply styles such as custom z-indexes. We need to be able to customize the mountNode element to apply this type of custom styles (microsoft/fluentui#26758).
Currently, there is no way to customize classes applied to that element.
The proposal is to allow passing objects to the mountNode prop. This can be achieved by extending the mountNode prop to accept an object, which can be one of the following:
function App() {
return (
<>
<Portal mountNode={element} />
<Portal mountNode={element} />
<Portal mountNode={{ element }} />
<Portal mountNode={{ className: 'foo' }} />
</>
);
}
positioning prop.mountNode is a slot.mountNode, add portal propfunction App() {
return (
<>
<Portal portal={element} />
<Portal portal={{ element }} />
<Portal portal={{ className: 'foo' }} />
</>
);
}
positioning prop.portal is a slot.<Portal portal={element} /> is not obvious as <Portal mountNode={element} />.mountNodeClassName propfunction App() {
return (
<>
<Portal mountNode={element} />
<Portal mountNode={element} mountNodeClassName="foo" />
</>
);
}