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

  • 2.0.6
  • 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 = [
  {
    gallery_src: 'http://example.com/example/img1_small.jpg',
    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',
    ],
    width: 681,
    height: 1024,
    aspect_ratio: 1.5
  },
  {
    gallery_src: 'http://example.com/example/img2_small.jpg',
    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',
    ],
    width: 600,
    height: 600,
    aspect_ratio: 1
  }
];

Photo properties

PropertyTypeDefaultDescription
gallery_srcstringundefinedRequired. Image used in the gallery collection
srcstringundefinedRequired. Image used for the lightbox
srcsetarrayundefinedOptional. Array of images for the lightbox.
widthnumberundefinedRequired. Width of the gallery image
heightnumberundefinedRequired. Height of the gallery image
aspect_rationumberundefinedRequired. Aspect ratio of the gallery image (width / height)

srcset

It is possible to serve up different images to the lightbox using srcset which is supported by React Images. The same srcset property can be passed into the photos property. See react-images documentation for more information on the srcset property.

Keywords

FAQs

Package last updated on 15 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