Portal API
API reference for the Portal component: its props with their token values and defaults, the styled-system prop groups, and forwarded HTML attributes.
Demos
For usage examples, visit the component demo page: Portal
Import
import { Portal } from '@soroush.tech/design-system/Portal'Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Content rendered into the container. |
container | HTMLElement | (() => HTMLElement | null) | null | document.body | Target node, or a function returning one. Falls back to document.body. |
Example
<Portal>
<Toast>Saved</Toast>
</Portal>
// Into an explicit node
<Portal container={() => document.getElementById('overlays')}>
<Dialog />
</Portal>
Source code
If this page does not answer your question, have a look at the implementation of the component for more detail.