Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-photo-gallery

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-photo-gallery

Responsive React Photo Gallery Component

  • 4.2.11
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

A responsive React photo gallery component.

Demo

http://neptunian.github.io/react-photo-gallery/

To build the examples locally, run:

npm install
npm start

Then open localhost:8000 in a browser.

Use

import React from 'react';
import Gallery from 'react-photo-gallery';

export default class Sample extends React.Component {
    render() {
	return (
	    <Gallery photos={PHOTO_SET} />
	);
    }
}

const PHOTO_SET = [
  {
    src: 'http://example.com/example/img1_small.jpg',
    width: 681,
    height: 1024,
    aspectRatio: 1.5,
    lightboxImage:{
	src: 'http://example.com/example/img1_large.jpg',
	srcset: [
	  'http://example.com/example/img1_1024.jpg 1024w',
	  'http://example.com/example/img1_800.jpg 800w',
	  'http://example.com/example/img1_500.jpg 500w',
	  'http://example.com/example/img1_320.jpg 320w',
	]
    }
  },
  {
    src: 'http://example.com/example/img2_small.jpg',
    width: 600,
    height: 600,
    aspectRatio: 1,
    lightboxImage:{
	src: 'http://example.com/example/img2_large.jpg',
	srcset: [
	  'http://example.com/example/img2_1024.jpg 1024w',
	  'http://example.com/example/img2_800.jpg 800w',
	  'http://example.com/example/img2_500.jpg 500w',
	  'http://example.com/example/img2_320.jpg 320w',
	]
    }
  }
];

PropertyTypeDefaultDescription
photosarrayundefinedRequired. Array of objects (photos)
disableLightboxbooleanfalseOptional
lightboxShowImageCountbooleanfalseOptional. Displays at the bottom of the photo index of total images. Eg. "5 of 20"
backdropClosesModalbooleantrueOptional. Clicking on backdrop closes the modal

Photos properties

PropertyTypeDefaultDescription
srcstringundefinedRequired. The src value of the gallery image
widthnumberundefinedRequired. Width of the gallery image
heightnumberundefinedRequired. Height of the gallery image
aspectRationumberundefinedRequired. Aspect ratio of the gallery image (width / height)
lightboxImageobjectundefinedRequired by default. If disableLightbox is true, Optional. See below for prop details.

lightboxImage prop properties

PropertyTypeDefaultDescription
srcstringundefinedRequired. Image used for the lightbox
srcsetarrayundefinedOptional. Array of srcsets for the lightbox
captionstringundefinedOptional. Caption for the lightbox image

Lightbox

This component uses React Images for Lightbox functionality. I've incorporated what I think to be useful Lightbox properties in context of a gallery into this component.

Keywords

FAQs

Package last updated on 14 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc