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

img-stacks

v0.3.3

Published

Beautiful, interactive image stacks for React

Readme

ImgStacks

A React component for creating beautiful, interactive image stacks with configurable aspect ratios and responsive behavior.

Demo

Live Demo

Demo Features

  • 🖱️ Hover over the stack to see the caption and animation effects
  • 🔍 Click to open the full-size image gallery
  • ⌨️ Press Esc, click outside, or use the close button to dismiss the dialog
  • 👆 Swipe left/right between images for a completely responsive experience

Features

  • 🖼️ Stacked image presentation with hover effects
  • 📐 Configurable aspect ratios (predefined or custom)
  • 📱 Responsive design with mobile-first approach
  • 🎭 Dark mode support
  • 🔍 Modal view for full-size images
  • 👆 Touch-optimized swipe navigation for when you don't want the full dialog experience
  • ✨ Smooth animations and transitions
  • ♿ Accessibility-friendly

Installation

npm install img-stacks
yarn add img-stacks
pnpm add img-stacks

Usage

import { ImgStack } from "img-stacks";

function MyComponent() {
  const images = [
    {
      src: "path/to/image1.jpg",
      alt: "Description of image 1",
      caption: "Caption for image 1",
    },
    {
      src: "path/to/image2.jpg",
      alt: "Description of image 2",
      caption: "Caption for image 2",
    },
  ];

  return (
    <ImgStack
      images={images}
      size={{ type: "aspect-ratio", width: 400, ratio: "wide" }}
    />
  );
}

Configuration

Image Configuration

Each image in the stack requires the following properties:

interface StackImage {
  src: string; // URL of the image
  alt: string; // Alt text for accessibility
  caption: string; // Caption shown in the dialog view
}

Size Configuration

The component supports two types of size configuration:

1. Aspect Ratio

{
  type: "aspect-ratio";
  width: number; // Desired width in pixels
  ratio: AspectRatio; // Predefined ratio or custom number
}

Predefined aspect ratios:

  • "square" (1:1)
  • "landscape" (4:3)
  • "wide" (16:9)
  • "ultrawide" (21:9)
  • "portrait" (3:4)
  • "tall" (9:16)

Or use a custom numeric ratio (e.g., 2.35 for cinemascope).

2. Fixed Size

{
  type: "fixed";
  width: number; // Width in pixels
  height: number; // Height in pixels
}

Responsive Behavior

The component is inherently responsive:

  • Uses the specified width as a maximum
  • Automatically scales down on smaller screens
  • Maintains aspect ratio at all sizes
  • No horizontal scrollbars

Examples

Default (Responsive)

<ImgStack images={images} />

Square Aspect Ratio

<ImgStack
  images={images}
  size={{ type: "aspect-ratio", width: 300, ratio: "square" }}
/>

Custom Aspect Ratio (Cinemascope)

<ImgStack
  images={images}
  size={{ type: "aspect-ratio", width: 400, ratio: 2.35 }}
/>

Fixed Size

<ImgStack images={images} size={{ type: "fixed", width: 400, height: 300 }} />

Best Practices

  1. Use same-size images for best visual results
  2. Provide meaningful alt text for accessibility
  3. Keep image stacks to 3-5 images for optimal performance
  4. Use aspect ratios that match your content type
  5. Consider mobile users when setting widths

License

MIT