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-simple-image-preview-1

v1.0.1

Published

A simple image preview component for React

Readme

ImagePreview and ImagePreviewGroup Components

The ImagePreview and ImagePreviewGroup are fully customizable React components for rendering and previewing images. They allow users to view images with features like zooming, rotating, and navigation through grouped images. These components also support dynamic styling and class customization.


Installation

To use these components, copy the ImagePreview and ImagePreviewGroup code into your project or install them from your published package if available.


Components

1. ImagePreview

ImagePreview allows a single image to be displayed with optional features like zooming, rotating, and a full-screen preview.

Basic Example

import React from 'react';
import { ImagePreview } from 'react-simple-image-preview';

const App: React.FC = () => {
  return (
    <div>
      <h1>Image Preview Example</h1>
      <ImagePreview
        src="https://via.placeholder.com/300"
        alt="Sample Image"
        width={300}
        height={200}
      />
    </div>
  );
};

export default App;

2. ImagePreviewGroup

ImagePreviewGroup enables grouping multiple ImagePreview components to provide navigation between them.

Basic Example

import React from 'react';
import { ImagePreviewGroup, ImagePreview } from 'react-simple-image-preview';

const App: React.FC = () => {
  return (
    <div>
      <h1>Image Preview Group Example</h1>
      <ImagePreviewGroup>
        <ImagePreview
          src="https://via.placeholder.com/300"
          alt="Image 1"
          width={300}
          height={200}
        />
        <ImagePreview
          src="https://via.placeholder.com/400"
          alt="Image 2"
          width={300}
          height={200}
        />
        <ImagePreview
          src="https://via.placeholder.com/500"
          alt="Image 3"
          width={300}
          height={200}
        />
      </ImagePreviewGroup>
    </div>
  );
};

export default App;

Advanced Customization

Using Custom Styles, Classes, and Icons

You can pass your own styles, classes, or icons to the images for better control over their appearance.

Example

<ImagePreview
  src="https://via.placeholder.com/300"
  alt="Custom Styled Image"
  width={300}
  height={200}
  style={{
    objectFit: 'cover',
    borderRadius: '8px',
  }}
  className="custom-image-class"
  icon={<MyCustomIcon />}
  iconPosition="topLeft"
  onIconClick={() => alert('Icon clicked!')}
/>

Props

ImagePreview Props

| Prop Name | Type | Default | Description | |-------------------|---------------------|---------------|-----------------------------------------------------------------------------| | src | string | undefined | The source URL of the image. | | alt | string | undefined | Alternative text for the image. | | width | number | undefined | The width of the image (in pixels). | | height | number | undefined | The height of the image (in pixels). | | preview | boolean | true | Enables the preview functionality. | | onClick | function | undefined | Custom callback when the image is clicked. | | style | CSSProperties | {} | Inline styles for the container. | | className | string | '' | Custom class name for the container. | | imgStyle | CSSProperties | {} | Inline styles for the image. | | imgClassName | string | '' | Custom class name for the image. | | modalStyle | CSSProperties | {} | Inline styles for the modal. | | modalClassName | string | '' | Custom class name for the modal. | | icon | ReactNode | undefined | Icon to display on the image. | | iconPosition | 'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight' | 'topRight' | Position of the icon. | | onIconClick | function | undefined | Callback when the icon is clicked. |

ImagePreviewGroup Props

| Prop Name | Type | Default | Description | |------------|------------|-------------|-----------------------------------------------------------------------------| | children | ReactNode| undefined | ImagePreview components to include in the group. | | onChange | function | undefined | Callback when the current image changes in the group. | | gap | string | '16px' | Spacing between grouped images. |


Features

  • Zoom and Rotate: Easily zoom in/out or rotate images with intuitive controls.
  • Group Navigation: Navigate between grouped images using ImagePreviewGroup.
  • Dynamic Styling: Fully customizable styles, classes, and inline properties for images and modals.
  • Icons and Actions: Add interactive icons to images and respond to icon clicks with custom callbacks.
  • Lightweight Modal: Images open in an interactive modal for full-screen viewing.
  • Accessibility: Includes ARIA attributes for screen readers and is keyboard-friendly.

Accessibility

These components are designed with accessibility in mind. They include ARIA attributes and ensure a seamless user experience for screen readers.


Contributing

Contributions are welcome! If you find bugs or have feature requests, feel free to open an issue or submit a pull request to the GitHub repository.


License

This component library is open-source and freely available for use.


Enjoy using the ImagePreview and ImagePreviewGroup components! Let us know if you have any feedback or improvements to suggest.