@crustack/portal
Generate a Portal component with defaults.
Usage
Generate a Portal component that renders content into specified DOM elements.
Use the defaultRoots option to define target elements for rendering.
When no target is found, content falls back to rendering in the document body.
Wrap your component in the Portal.
Use a different root element for this portal:
API Reference
👉 definePortal
Create a custom Portal component.
DefinePortalOptions
| Prop | Type | Default |
|---|---|---|
defaultRoots? | Root[] | - |
👉 Portal
The component returned by definePortal. It renders its children into the specified root.
PortalProps
| Prop | Type | Default |
|---|---|---|
root? | Root | document.body |
children | ReactNode | - |