brf/client/shared/components/portal.tsx
2025-12-18 07:31:37 +01:00

10 lines
334 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