1.0.1 • Published 5 years ago
react-modal-gallery v1.0.1
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
Prop | Type | Description | isRequired | Default |
---|---|---|---|---|
images | Array of objects | Array of objects containing image, caption and description. (See above example for reference) | Yes | NA |
title | string | Title of the image gallery | Yes | NA |
cycle | boolean | Enable/disable infinite cycling of slides | No | false |
currentSlideIndex | number | Index of image from which the scrolling starts. Same image is used in the gallery's preview. | No | 0 |
width | string | Sets the width of the preview. Examples: '100%', '50vw' | No | '100%' |
height | string | Sets the height of the preview. Examples: '300px', '40%' | No | '50vh' |
thumbnailsToBeDisplayed | number | Number of thumbnails that are visible at a time. | No | 8 |
License
MIT