Part of the Ant Design ecosystem.
🌀 React portal primitive with lifecycle-friendly container handling.
English | 简体中文
| Area | Support |
|---|---|
| Purpose | React portal primitive with lifecycle-friendly container handling. |
| Package | @rc-component/portal |
| Release | @rc-component/np / rc-np |
npm install @rc-component/portalimport Portal from '@rc-component/portal';
export default () => <Portal open>Hello World</Portal>;| Prop | Description | Type | Default |
|---|---|---|---|
getContainer |
Customize portal container. | Element | () => Element | string | false |
document.body |
open |
Whether to render portal content. | boolean |
false |
autoLock |
Lock page scroll when the portal is open. | boolean |
false |
npm install
npm start
npm test
npm run lint
npm run tsc
npm run compileThe dumi site runs at http://localhost:8000.
npm run prepublishOnlyThe release flow is handled by @rc-component/np through the rc-np command when the package uses the shared release flow.
@rc-component/portal is released under the MIT license.