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-blackbox

v1.0.1

Published

A simple react component for displaying an array of images

Downloads

12

Readme

React Images Viewer

A simple react component for displaying an array of images.

Quick start

npm install --save react-blackbox
import React from 'react';
import Blackbox from 'react-image-viewer';

export default class Example extends React.Component {
  ...
  render() {
    return (
      <Blackbox
        images={[{ src: 'http://example.com/img1.jpg' }, { src: 'http://example.com/img2.jpg' }]}
        isOpen={this.state.blackBoxIsOpen}
        onClickPrev={this.gotoPrevious}
        onClickNext={this.gotoNext}
        onClose={this.closeBlackbox}
      />
    );
  }
}

To build the examples locally, run:

npm install
npm start

Then open localhost:8000 in a browser.

Example using caption for the first image:

<Blackbox
  images={Blackbox_IMAGE_SET}
  ...
/>

const BlackBox_IMAGE_SET = [
  {
    src: 'http://example.com/example/img1.jpg',
    caption: 'Sydney, Australia - Photo by Jill Smith',
  },
  {
    src: 'http://example.com/example/img2.jpg',
  }
];

Options

Property | Type | Default | Description :-----------------------|:--------------|:--------------|:-------------------------------- backdropClosesModal | bool | false | Allow users to exit the blackbox by clicking the backdrop closeButtonTitle | string | ' Close (Esc) ' | Customize close esc title enableKeyboardInput | bool | true | Supports keyboard input - esc, arrow left, and arrow right currentImage | number | 0 | The index of the image to display initially customControls | array | undefined | An array of elements to display as custom controls on the top of blackbox images | array | undefined | Required. An array of objects containing valid src and srcset values of img element imageCountSeparator | String | ' of ' | Customize separator in the image count isOpen | bool | false | Whether or not the blackbox is displayed leftArrowTitle | string | ' Previous (Left arrow key) ' | Customize of left arrow title onClickPrev | func | undefined | Fired on request of the previous image onClickNext | func | undefined | Fired on request of the next image onClose | func | undefined | Required. Handle closing of the blackbox onClickImage | func | undefined | Handle click on image onClickThumbnail | func | undefined | Handle click on thumbnail preloadNextImage | bool | true | Based on the direction the user is navigating, preload the next available image rightArrowTitle | string | ' Next (Right arrow key) ' | Customize right arrow title showCloseButton | bool | true | Optionally display a close "X" button in top right corner showImageCount | bool | true | Optionally display image index, e.g., "3 of 20" width | number | 1024 | Maximum width of the carousel; defaults to 1024px hideArrow | bool | false | Show image arrow to change images