Components / Transitions and utilities
Portal
Renders children into document.body (or container), outside overflow and stacking contexts.
import { Portal } from "@stylhero/ui";
Example
Code
import { Box, Portal, Text } from "@stylhero/ui";
function PortalExample() {
// renders into document.body, outside this box's overflow
return (
<Box p={3} border radius="md" style={{ overflow: "hidden", height: 60 }}>
Inside a clipped box.
<Portal><Text variant="small" tone="muted" style={{ position: "fixed", bottom: 8, left: 8 }}>Rendered in document.body</Text></Portal>
</Box>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children required |
ReactNode |
- | |
container |
Element | null |
- |
Generated from src/utils.tsx. Something wrong or missing? Open an issue.