Skip to Content

Portal

The portal is a component that wraps React’s createPortal method to provide a better DX for creating portals. It will automatically inject elements to the body rather than having to manually do that via the core method in React.

Examples

This component can be used via element api.

API

Portal 

NameTypeDefault
elementstring

Element to create for the portal.

'div'
classNamestring

Class name to apply to the portal element.

styleCSSProperties

Style to apply to the portal element.

onMount() => void

Callback for portal mounts.

onUnmount() => void

Callback for portal unmounts.

Last updated on