1.0.1 • Published 5 years ago

react-modal-gallery v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

react-modal-gallery

A simple React image gallery component with full screen modal slideshow

Features

  • Full screen modal gallery with thumbnail navigation
  • Gallery preview which can clicked on for the fullscreen view.
  • Display captions and big descriptions along with the images
  • The View All view can be used for navigating galleries with large number of images

Installation

npm install --save react-modal-gallery

Usage

An example using react-modal-gallery

import React, { Component } from 'react';
import ReactModalGallery from 'react-modal-gallery';

const images = [
    {
        image: 'images/image_1.jpg',
        caption: 'Caption for image_1',
        description: 'Description for image_1'
    },
    {
        image: 'images/image_2.jpg',
        caption: 'Caption for image_2',
        description: 'Very big description for image_2'
    },
    {
        image: 'images/image_3.jpg',
        caption: 'Image with no description'
    }
];

class App extends Component {
  render() {
    return (
        <div className="App"> 
            <ReactModalGallery images={images} title={"Example Image Gallery"}/>
        </div>
    );
  }
}
export default App;

Props

PropTypeDescriptionisRequiredDefault
imagesArray of objectsArray of objects containing image, caption and description. (See above example for reference)YesNA
titlestringTitle of the image galleryYesNA
cyclebooleanEnable/disable infinite cycling of slidesNofalse
currentSlideIndexnumberIndex of image from which the scrolling starts. Same image is used in the gallery's preview.No0
widthstringSets the width of the preview. Examples: '100%', '50vw'No'100%'
heightstringSets the height of the preview. Examples: '300px', '40%'No'50vh'
thumbnailsToBeDisplayednumberNumber of thumbnails that are visible at a time.No8

License

MIT