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

@erock530/react-iframe

v1.0.2

Published

A lightweight React component for rendering iframes with custom headers

Readme

React IFrame Component

A lightweight React component for rendering iframes with custom headers. Perfect for embedding authenticated content or adding custom headers to iframe requests.

Features

  • 🚀 Zero external dependencies
  • 📦 Lightweight and performant
  • 🔐 Support for custom headers (including authentication)
  • ⚛️ Built with modern React practices
  • 📱 TypeScript support ready

Installation

npm install --save @erock530/react-iframe

Quick Start

import Iframe from "@erock530/react-iframe";

function App() {
  const token = localStorage.getItem("token");

  return (
    <Iframe
      src="/dashboard"
      headers={{
        Authorization: `Bearer ${token}`,
        "Content-Type": "text/html",
      }}
      width="100%"
      height="600px"
    />
  );
}

API Reference

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | src | string | ✅ | The URL to embed in the iframe | | headers | object | ✅ | Custom headers to include with the request | | width | string \| number | ❌ | Width of the iframe (default: 100%) | | height | string \| number | ❌ | Height of the iframe (default: 400px) | | ...props | HTMLIFrameElement | ❌ | Any additional iframe attributes |

Example with Authentication

import Iframe from "@erock530/react-iframe";
import Cookies from "js-cookie";

function AuthenticatedEmbed() {
  const token = localStorage.getItem("token") || Cookies.get("token");

  return (
    <Iframe
      src="/protected-content"
      headers={{
        Authorization: `Bearer ${token}`,
        "X-Requested-With": "XMLHttpRequest",
      }}
      width="100%"
      height="500px"
      style={{ border: "1px solid #ccc", borderRadius: "8px" }}
    />
  );
}

Development

This project uses a modern development workflow with hot reloading and automatic compilation.

Local Development Setup

  1. Start the build watcher (compiles src/ to dist/ on changes):

    npm start
  2. Start the example app (in a separate terminal):

    cd example
    npm start

The example app will automatically reload when you make changes to either the library source or the example code.

Project Structure

├── src/           # Component source code
├── dist/          # Compiled output
├── example/       # Example React app for testing
└── package.json   # Package configuration

Publishing

Build and publish to npm:

npm publish

This will:

  • Build both CommonJS and ES module versions
  • Generate type definitions (if using TypeScript)
  • Publish to the npm registry

Peer Dependencies

Make sure to properly configure peer dependencies in package.json. The build system will automatically exclude them from the bundle.

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and test thoroughly
  4. Submit a pull request

License

MIT License - see [LICENSE] file for details.

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.