@highlight-ui/utils-portal-manager
v3.2.0
Published
A collection of portal managers used by UI-components in Personio
Downloads
6,875
Maintainers
Keywords
Readme
@highlight-ui/utils-portal-manager
Installation
yarn add @highlight-ui/utils-portal-manager
Usage
PortalManager.containerInstance()
This function creates, or if it exists, returns the global portals container DOM element.
import { PortalManager } from '@highlight-ui/utils-portal-manager';
// Creates a new DOM element
const newPortalsContainer = PortalManager.containerInstance();
// Returns the existing DOM element
const existingPortalsContainer = PortalManager.containerInstance();
console.log(newPortalsContainer == existingPortalsContainer); // => true
GroupedPortal
React component that appends a portal to the global portals container.
import { GroupedPortal } from '@highlight-ui/utils-portal-manager';
const MyComponent = () => {
return (
<GroupedPortal>
This content is rendered in the global portals container.
</GroupedPortal>
);
};