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

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
increased by18.3%
Maintainers
1
Weekly downloads
 
Created
Source

A responsive React photo gallery component that uses React Images as a lightbox.

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',
	]
    }
  }
];

Photo 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. Accepts 'src' and 'srcset' values of the lightbox image. See below

lightboxImage property properties

PropertyTypeDefaultDescription
srcstringundefinedRequired. Image used for the lightbox
srcsetarrayundefinedOptional. Array of images for the lightbox

See React Images for details on lightbox 'images' prop.

Keywords

FAQs

Package last updated on 16 Dec 2015

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