brf/client/shared/components/portal.tsx
2025-12-13 21:12:08 +01:00

10 lines
333 B
TypeScript

import { type ContainerNode, type FunctionComponent } from 'preact'
import { createPortal } from 'preact/compat'
const Portal: FunctionComponent<{ container: ContainerNode }> = ({
children,
container = typeof document !== 'undefined' && document.body,
}) => container && createPortal(children, container)
export default Portal