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

reactjs-photo-image-gallery

v2.0.2

Published

Lightweight, responsive, and customizable Photo Image Gallery for React with TypeScript support.

Readme

reactjs-photo-image-gallery

npm version npm downloads bundle size license

A lightweight, responsive, and customizable Photo Image Gallery / Carousel component for React with full TypeScript support.

  • ⚡ Ultra lightweight: Zero external runtime dependencies, under ~5 KB gzipped.
  • 🛡️ Full TypeScript Support: Built-in comprehensive type definitions.
  • 🎯 Interactive Controls: Previous/Next navigation arrows, dot pagination, and optional thumbnail strip.
  • 📱 Mobile & Keyboard Ready: Touch swipe gestures and Left/Right arrow key navigation.
  • 🔒 Memory-Safe: Cleaned up timer intervals to prevent memory leaks.
  • 🎨 Modern & Clean: Smooth fade transitions, modern theme overlay (Dark, Light, Auto).
  • ⏸️ Pause on Hover: Automatically pauses slideshow when user hovers over an image.
  • 🔄 100% Backward Compatible: Supports both new modern prop API and legacy pi_gallery props.

Installation

npm install reactjs-photo-image-gallery
# or
yarn add reactjs-photo-image-gallery
# or
pnpm add reactjs-photo-image-gallery

Note: Don't forget to import the CSS in your app or entry file:

import 'reactjs-photo-image-gallery/dist/index.css';

Quick Start (Modern API)

import React from 'react';
import { PhotoGallery } from 'reactjs-photo-image-gallery';
import 'reactjs-photo-image-gallery/dist/index.css';

const images = [
  {
    src: 'https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=1200',
    title: 'Majestic Mountains',
    alt: 'Mountains',
    url: 'https://example.com/mountains',
    target: '_blank',
  },
  {
    src: 'https://images.unsplash.com/photo-1511497584788-87676104235f?w=1200',
    title: 'Serene River Flow',
    alt: 'River',
  },
  {
    src: 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=1200',
    title: 'Golden Sunset',
    alt: 'Sunset',
  },
];

export default function App() {
  return (
    <div style={{ maxWidth: '800px', margin: '40px auto' }}>
      {/* With Navigation Arrows and Thumbnails */}
      <PhotoGallery
        images={images}
        interval={4000}
        width="100%"
        height="450px"
        showArrows={true}
        showThumbnails={true}
        pauseOnHover={true}
        theme="dark"
      />
    </div>
  );
}

Props Reference

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | images (or items) | GalleryItem[] | [] | List of gallery slides to render | | interval | number | 5000 | Transition duration in milliseconds | | width | string \| number | undefined | Gallery container max-width or width | | height | string \| number | undefined | Gallery container max-height or height | | showArrows | boolean | true | Show Prev/Next navigation arrow buttons | | showIndicators | boolean | true | Show dot pagination indicators | | showThumbnails | boolean | false | Show interactive thumbnail preview strip below slider | | thumbnailHeight| string \| number | 60 | Height in pixels or CSS value of thumbnail strip items | | keyboardNav | boolean | true | Navigate with Left and Right arrow keys | | enableSwipe | boolean | true | Enable touch swipe gestures on mobile | | autoPlay | boolean | true | Automatically advance slides | | pauseOnHover | boolean | true | Pause slideshow on mouse hover | | showTitle | boolean | true | Show or hide image title overlays | | theme | 'auto' \| 'light' \| 'dark' | 'auto' | Overlay background/color theme | | objectFit | 'cover' \| 'contain' \| ... | 'cover' | CSS object-fit property of the images | | className | string | undefined | Custom class name for the wrapper | | style | CSSProperties | undefined | Custom inline style for the wrapper | | onSlideChange | (index, item) => void | undefined | Callback invoked when active slide changes | | pi_gallery | PhotoGalleryLegacyProps| undefined | Legacy v1 configuration object |

GalleryItem Structure

interface GalleryItem {
  src: string;              // Image URL (required)
  thumbnail?: string;       // Optional custom thumbnail image URL
  alt?: string;             // Image accessibility alt text
  title?: string;           // Caption or title displayed over slide
  url?: string;             // Optional hyperlink destination
  target?: string;          // Link target: '_blank', '_self', etc.
  url_enable?: boolean;     // Legacy flag: false disables navigation
}

Backward Compatibility (Legacy v1 Support)

Existing projects using PI_Gallery and pi_gallery prop continue to work out of the box with arrows and indicators:

import { PI_Gallery } from 'reactjs-photo-image-gallery';
import 'reactjs-photo-image-gallery/dist/index.css';

const pi_gallery = {
  width: "500px",
  height: "300px",
  timer: 5000,
  pi_list: [
    {
      src: "/images/photo-1.jpg",
      alt: "Photo 1",
      url_enable: true,
      url: "#",
      target: "_blank",
      title: "Photo 1 Title",
    },
    {
      src: "/images/photo-2.jpg",
      alt: "Photo 2",
      url_enable: false,
      title: "Photo 2 Title",
    },
  ],
};

function App() {
  return <PI_Gallery pi_gallery={pi_gallery} />;
}

Author & Socials

License

MIT