Files

8 lines
346 B
TypeScript
Raw Permalink Normal View History

2026-10-12 17:58:43 -04:00
import React from 'react';
2022-06-20 14:16:42 -04:00
import { createPortal } from 'react-dom';
2026-10-12 17:58:43 -04:00
/** Renders `children` into the page's overlay layer, or the body where there is none, as in tests. */
2026-10-05 18:10:18 -04:00
export default function Portal({ children }: { children: React.ReactNode }) {
2026-10-12 17:58:43 -04:00
return createPortal(children, document.getElementById('modal-portal') ?? document.body);
2026-10-05 18:10:18 -04:00
}