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

  • 6.0.26
  • Source
  • npm
  • Socket score

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

Join the chat at https://gitter.im/react-photo-gallery/Lobby npm version Build Status Coverage Status

  • Stateless, responsive, accessible, and highly customizable
  • Maintains the original aspect ratio of your photos
  • Uses actual image elements, optionally pass in srcSet and sizes attributes
  • Supports passing in a custom image component for implementation of things like image selection, favorites, captions, or whatever your little heart desires!

Preview

Installation

To install:

npm install --save react-photo-gallery

Documentation and Examples

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

To build some examples locally, run:

yarn install
yarn start

Then open localhost:8000 in a browser.

Use


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.jpg',
    width: 4,
    height: 3
  },
  {
    src: 'http://example.com/example/img2.jpg',
    width: 1,
    height: 1
  }
];

PropertyTypeDefaultDescription
photosarrayundefinedrequired; array of objects
columnsnumber3optional; number of photos per row
onClickfunctionundefinedoptional; do something when the user clicks a photo; receives arguments event and an object containing the index, photo obj originally sent and the next and previous photos in the gallery if they exist
marginnumber2optional; number of margin pixels around each entire image
ImageComponentfunctiondefault componentoptional; use a different image component than the default provided to display your photo

Photos array item properties (passed into Gallery's photos property)

PropertyTypeDefaultDescription
srcstringundefinedrequired; the img src attribute value of the image
srcSetarrayundefinedoptional; array of strings for the srcSet attribute of the image
sizesarrayundefinedoptional; array of strings for the sizes attribute of the image
widthnumberundefinedrequired; original width of the gallery image (only used for calculating aspect ratio)
heightnumberundefinedrequired; original height of the gallery image (only used for calculating aspect ratio)
altstringundefinedoptional; alt text of the gallery image

Keywords

FAQs

Package last updated on 25 May 2018

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