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

react-universal-image

v0.2.2

Published

React Universal Image

Readme

React Universal Image

react-universal-image

Features

  • Lazy load
  • Placeholder
  • Progressive image loading (as on Medium.com)
  • Image error fallback

Installation

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import Image from 'react-universal-image';

const App = () => {
    
    return (
        <div>
            <image
                src="img-400x200.jpg"
                srcSet="img-400x200.jpg 400w, img-800x400.jpg 800w"
                placeholder="img-20x10.jpg"
                ratio={2}
                fallback="image-not-found.jpg"
                className="post-image"
            />
        </div>
    );
};

ReactDOM.render(<App />, document.body);

Props

src

Type: String, Default: undefined, Required

Required property. Sets the src attribute of an image.

<Image src="img.jpg" />

srcSet

Type: String, Default: undefined

Sets the srcset attribute of an image.

<Image src="img-800x400.jpg" srcSet="img-400x200.jpg 400w, img-800x400.jpg 800w" />

placeholder

Type: String/Node, Default: undefined

Specify a placeholder image URL or Component for lazy loaded image.

<Image src="img-800x400.jpg" placeholder="img-20x10.jpg" />
<Image src="img-800x400.jpg" placeholder="data:image/jpeg;base64,/..." />
<Image src="img-800x400.jpg" placeholder={<span>loading...</span>} />

blur

Type: Number, Default: 3

Specify a blur level of a placeholder image. Set 0 to disable blurring.
NOTISE Works only if placeholder was defined as image URL

<Image src="img-800x400.jpg" placeholder="img-20x10.jpg" blur={1} />

ratio

Type: Number, Default: undefined

<Image src="img-800x400.jpg" ratio={2.0} />
<Image src="img-800x400.jpg" ratio={800/400} />
<Image src={this.pops.src} ratio={this.pops.width / this.pops.height} />

debounce

Type: Number, Default: 200

<Image src="img.jpg" debounce={1000} />

animationSpeed

Type: Number, Default: 400

<Image src="img-800x400.jpg" placeholder="img-20x10.jpg" animationSpeed={800} />

fallback

Type: String, Default: undefined

<Image src="img.jpg" fallback="image-not-found.jpg" />

maxWidth

Type: Number/String, Default: undefined

<Image src="img.jpg" maxWidth="200px" />
<Image src="img.jpg" maxWidth={200} />
<Image src="img.jpg" maxWidth="50%" />

inline

Type: Bool, Default: false

<Image src="img.jpg" maxWidth="50%" inline />

id

Type: String, Default: undefined

<Image src="img.jpg" id="image_1" />

className

Type: String, Default: undefined

<Image src="img.jpg" className="post-image" />

alt

Type: String, Default: undefined

Sets the alt attribute of an image and placeholder.

<Image src="img.jpg" alt="Nature" />

crossOrigin

Type: String, Default: undefined

Sets the crossorigin attribute of an image and placeholder.

<Image src="img.jpg" crossorigin="anonymous" />

sizes

Type: String, Default: undefined

Sets the sizes attribute of an image.

<Image src="img-800x400.jpg" srcSet="img-400x200.jpg 400w, img-800x400.jpg 800w" sizes="(max-width: 800px) 100vw, 800px" />