JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24551
  • Score
    100M100P100Q141513F
  • License MIT

Lightweight Lightbox React Component

Package Exports

  • react-modal-image

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-modal-image) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-modal-image

Travis npm package Coveralls

This is a tiny React component providing modal image Lightbox.

DEMO

Features

  • Only 3 kB when gzipped.
  • Zero dependencies.
  • Includes builds for CommonJS and ES modules.
  • For React 15.x and 16.x.
  • Image alt text displayed as caption
  • Download button
  • Zoom and move the image

You need to provide a polyfill for Object.assign() in your app to support old Internet Explorers.

API

import ModalImage from 'react-modal-image'

<ModalImage
  preview={urlToTinyImageFile}
  fullscreen={urlToLargeImageFile}
  download={urlToHugeImageFile}
  alt="Hello World!"
/>
Prop Type Description
alt String alt text for the preview img and shown as a caption when the Lightbox is open.
preview URL The small img to be rendered. Clicking the image will open Lightbox.
fullscreen URL This is shown if Lightbox is open. Can be zoomed in/out and dragged around.
download URL Image to be downloaded when you click the download icon on the top right corner.