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

seamless-iframe

v0.1.3

Published

Seamless Iframe is a customisable React component that allows you to render HTML content in an iframe and makes it look as if it was part of the page itself. Seamless! ๐Ÿ‘ป

Readme

Seamless Iframe ๐Ÿ”ฎ

Build Build ESlint Size Dependencies Coverage

Seamless Iframe is a customisable React component that allows you to render HTML content in an iframe and makes it look as if it was part of the page itself. Seamless! ๐Ÿ‘ป

Quick examples

๐ŸŽจ Inherits styles from the parent document and vertically updates its height

Demo for style and resize

๐Ÿ”— Handle user clicks on links

Demo for handling link clicks

Usage

import { SeamlessIframe } from "seamless-iframe";

const myHtml = sanitize("<div>hello</div>"); // HTML sanitisation is still recommended.

export const MyPage = (props) => {
    return ( 
        <SeamlessIframe
            sanitizedHtml={myHtml}
            customStyle={`
                body {
                    font-family: sans-serif;
                }
            `}
        />
    );
}

Props

| Property | Type | Description | Default | | --- | --- | --- | --- | | sanitizedHtml | String | Required - HTML string of text to be rendered in the iframe. We suggest to sanitize the HTML before passing to the component. | - | | inheritParentStyle| Boolean | Whether to inherit styles on the parent page or not | true | title| String | Title of the iframe, important for accessibility | "" | customStyle | String | Extra set of css rules for the inner content | body { margin: 0; padding: 0; } | | customScript | String | Extra script to be added to the iframe body | `` | | heightCorrection | Boolean | Whether to apply the iframe content scroll height to the iframe element or not | true |
| heightCorrectionOnResize | Boolean | Whether to re apply the height on resize. Off is heightCorrection is false | true | | debounceResizeTime | Number | Debounce time for reapplying height on the window resize event. If set to 0, no debounce function will be applied | 250 | | interceptLinkClicks | Boolean | Whether to listen to link clicks. If enabled, the parent window will show a confirmation whenever a link in the iframe gets clicked | false | | customLinkClickCallback | Function | Function to manipulate the behaviour of the top window on link click. Useless if interceptLinkClicks is falsy. | - | | preventIframeNavigation | Boolean | Whether to prevent the iframe to navigate to a different URL. If a script inside the iframe tries to change the iframe window location, Seamless Iframe will repaint from the initial state. If this happens multiple times, a warning view gets displayed instead of the iframe.| true | | customIframeNavigationInterceptedView | ReactElement | Replace the default warning view when iframe tries to navigate away. | - |

Abstract

What does this library do?

It provides a React component with a set of utilities to render custom HTML in an iframe that looks as if it was part of your page.

Normal iframes in fact:

  1. don't inherit styles from the parent window
  2. don't provide an easy way to set their full height
  3. don't allow users to open links on the top level window
  4. don't prevent scripts to change the iframe location

Here's where SeamlessIframe comes in handy. The generated iframes will automatically set their height depending on the content, and they will inherit the parent window or custom styles. In addition, it allows you to quickly customise what happens when a user clicks on a link. If a script (that somehow made it through the sanitization process) inside the iframe tries to manipulate the location (url) of the iframe, SeamlessIframe will intercept it and prevent it from happening.

Why would you use an iframe to render html?

In summary, further security.

There are a number of great sanitized libraries out there that prevents malicious scripts from being injected in your page.

However, if these libraries fail is good to have another layer of security. Iframes and their powerful sandbox attribute prevents a number of potentially dangerous behaviours.