Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

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

PropTypeDefaultDescription
children required ReactNode -
container Element | null -

Generated from src/utils.tsx. Something wrong or missing? Open an issue.