Description
@rc-component/portal is a React portal primitive that renders content outside the normal component tree, into a container of your choosing, with careful handling of the container through the component's lifecycle. It is part of the Ant Design ecosystem and is maintained as one of the rc-component packages that other React component libraries build on. You control where the portal renders with the getContainer prop, which accepts an element, a function that returns one, or a string, and it defaults to the document body. The open prop decides whether the portal content is rendered, and the autoLock prop locks page scroll while the portal is open, which is useful for modal overlays. The README includes install and usage examples, a development setup that runs a local documentation site on port 8000, and a release process that uses the shared rc-np release tool when the package uses it. It suits component authors who need a dependable portal for popups, modals and overlays, rather than a finished modal component. The package is released under the MIT license.…
Highlights
- React portal primitive with lifecycle-friendly container handling
- getContainer prop to choose where the content renders
- open prop to control whether content is rendered
- autoLock prop to lock page scroll while open
Ratings & Reviews
No ratings yet
Be the first to rate @rc-component/portal.
People also visit

react-relative-portal
React component for place dropdowns outside overflow: hidden; elements
@rc-component/portal FAQ
What does it do?
It renders React content into a container outside the normal tree, which overlays and modals need.
Where does it render by default?
In document.body, unless you pass getContainer.
Can it lock page scroll?
Yes. The autoLock prop locks page scroll while the portal is open.
Is it a finished modal?
No. It is a portal primitive that component authors build popups and modals on.
What are the best @rc-component/portal alternatives?
Popular alternatives to @rc-component/portal include react-portal, react-modal and react-relative-portal. See all @rc-component/portal alternatives



















