Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-document-portal

jacobbuck15.6kMIT1.2.1

React component which renders its children inside a portal attached to the document.

react, component, portal, document, body, ssr

readme

react-document-portal

React component which renders its children inside a portal attached to the document.

  • :gift: Lightweight npm bundle size
  • :smile: Easy to use with simple API
  • :printer: Server-side rendering out of the box
  • :dolphin: Runs on Internet Explorer

Usage

<DocumentPortal>…</DocumentPortal>

Props

  • as tagName string used to create portal container, defaults to "div".
  • children any elements to render inside a portal.

Requirements

Requires a minimum of React v16.8.0.

changelog

Changelog

v1.2.1 - 2022-04-12

Changed

v1.2.0 - 2021-12-15

Added

  • Added source maps to build output.

Changed

  • Updated react and react-dom peer-dependencies to support v17 and v18.

Removed

v1.1.0 - 2020-10-18

Added

  • Added as prop for defining the tag name of the portal's containing element.
  • Added support for refs.

Removed

  • Removed defaultProps in favour of default values in object destructuring.

v1.0.1 - 2020-09-01

Changed

  • Updated propTypes to only be defined in non-production environments.

v1.0.0 - 2020-08-31

Initial public version! :tada: