npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iqvizyonui/react-portal

v9.8.16

Published

A utility component that creates portals compatible with Iqvizyon UI

Readme

@iqvizyonui/react-portal

React Portal components for Iqvizyon UI React

This package contains the Portal component, which allow consumers to render React portals with Iqvizyon styling and RTL awareness.

Usage

Portal

Portal can be used as standalone with any part of an Iqvizyon app. The component should be under a IqvizyonProvider in the tree to make sure that proper theming and RTL handling is available.

By default Portal will render content to document body

<IqvizyonProvider>
  <Portal>Content rendered by default to Iqvizyon's document.body</Portal>
</IqvizyonProvider>

The mount location of the portal can be customized

const node = document.getElementById('customNode');

<Portal mountNode={node}>Render to a custom node in DOM</Portal>;

Styling

Portal renders React children directly to the default/configured DOM node. Therefore styling should be applied to the children by users directly.

Virtual parents

Out of order DOM elements can be problematic when using 'click outside' event listeners since you cannot rely on element.contains(event.target) because the Portal elements are out of DOM order.


const outerButtonRef = React.useRef();
const innerButtonRef = React.useRef();


<Portal>
  <div>
    <button ref={outerButtonRef}> Outer button </button>
    <Portal>
      <div>
        <button ref={innerButtonRef}> Inner button </button>
      </div>
    </Portal>
  </div>
</Portal>

// DOM output
<div>
  <button>Outer button</button>
</div>

<div>
  <button>Inner button</button>
</div>

// Let's add an event listener to 'dismss' the outer portal when clicked outside
// ⚠⚠⚠ This will always be called when clicking on the inner button
document.addEventListener((event) => {
  if (outerButtonRef.current.contains(event.target)) {
    dismissOuterPortal();
  }
})

When the above case is not required, using element.contains is perfectly fine. But nested cases should still be handled appropriately. We do this using the concept of virtual parents

Portal will make public 2 utilities that will only be used in cases where the user needs to know if an out of order DOM element will need to be used or not.

  • setVirtualParent - sets virtual parent. Portal uses this already internally.
  • elementContains - similar to element.contains but uses the virtual hierarchy as reference

Below shows what a virtual parent is

// Setting a virtual parent

const parent = document.getElementById('parent');
const child = document.getElementById('child');

child._virtual.parent = parent;

Portals will render a hidden span that will be the virtual parent, by nesting portals virtual parens will also be nested so that elementContains will work predictably.

<IqvizyonProvider>
  <Portal id="portal-1" />
  <Portal id="portal-2" />
</IqvizyonProvider>

DOM output:

<body>
  <div>
    {/* Virtual parent for portal*/}
    <span aria-hidden />
    {/* Virtual parent for portal*/}
    <span aria-hidden />
  </div>

  <div id="portal-1" class="theme-provider-0">
    {children}
  </div>
  <div id="portal-2" class="theme-provider-0">
    {children}
  </div>
</body>
<IqvizyonProvider>
  <Portal id="portal-1">
    <Portal id="portal-2" />
  </Portal>
</IqvizyonProvider>

DOM output:

<body>
  <div>
    {/* Virtual parent for outer portal*/}
    <span aria-hidden></span>
  </div>

  <div id="portal-1" class="theme-provider-0">
    {/* Virtual parent for inner portal*/}
    <span aria-hidden />
    {children}
  </div>
  <div id="portal-2" class="theme-provider-0">
    {children}
  </div>
</body>