Portal

Create a React portal quickly and easily using the portal component.

Examples

Contents

UsageAPIs

Usage

React portals allow you to render content into the root of the page that act as children of the portal. This means that JavaScript events will flow up through the portal back to the parent naturally, making event management easier. Read more about React portals here.

APIs

IPortalProps

bypassActiveElementFocusOnUnmount
boolean
By default, the focus is returned to the previously active element when the portal is unmounted. Set this flag to true to bypass this action.
className
string
Optional className to add to the root of the portal.
parentClassName
string
Optional className to add to the portal host.
portalElement
HTMLElement
Optional parentElement that will contain the portal tree.
portalSelector
string
Optional selector for the parentElement that will contain the portal tree.

Loaded Portal page