Installations
npm install react-gallery-designer
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.15.3
NPM Version
6.14.9
Score
66.3
Supply Chain
92.9
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (99.52%)
HTML (0.48%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
LongStoryMedia
Download Statistics
Total Downloads
92,468
Last Day
68
Last Week
407
Last Month
1,806
Last Year
25,644
GitHub Statistics
MIT License
2 Stars
101 Commits
1 Forks
2 Watchers
7 Branches
1 Contributors
Updated on Jun 23, 2022
Bundle Size
40.22 kB
Minified
12.81 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.4.5
Package Id
react-gallery-designer@1.4.5
Unpacked Size
102.79 kB
Size
31.52 kB
File Count
7
NPM Version
6.14.9
Node Version
14.15.3
Total Downloads
Cumulative downloads
Total Downloads
92,468
Last Day
61.9%
68
Compared to previous day
Last Week
6.8%
407
Compared to previous week
Last Month
12.7%
1,806
Compared to previous month
Last Year
-2.4%
25,644
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
28
React Gallery Designer
Installation
yarn
1$ yarn add react-gallery-designer
npm
1$ npm install react-gallery-designer
The UMD build is also available on unpkg:
1<script src="https://unpkg.com/react-gallery-designer/umd/react-gallery-designer.min.js"></script>
If you use the UMD build you can find the library on window.__RGD
.
Demos
lightbox
rotator
fade
rss
carousel
Props
images (required)
type: array
description: Array of objects representing the props for each image. This library uses react-image-designer for each image (and thumbnail) in the gallery. In addition to the props from react-image-designer
, you may also define the following:
- link
default: ""
type: string
description: Url to link image.
- target
default: false
type: boolean
description: add target="_blank" rel="noopener noreferrer"
to the a
tag.
- index
default: 0
type: number
description: Index of image in array. Array will be sorted to user defined order if index is provided.
- caption
default: ""
type: string
description: Caption for image.
additionally the following props are not modifiable on the image object because they are either taken care of at the global level, or are handled by react-gallery-designer
internally (and changing that would break it):
- id
- className
- contain
- tag
settings
- lightbox
default: false
type: boolean
description: Displays all images in a row wrap
flex-box, and expands an image to full screen on click with "next", and "prev" controls. Returns to previous view state on click when expanded.
- inview
default: 1
type: number
description: Number of images visible on screen at one time.
- auto
default: false
type: boolean
description: If slide should start rotating right away.
- noImages
default: false
type: boolean
description: Useful for a rotating rss feed or similar application.
- direction
default: "left"
type: string
description: Direction in which the gallery should rotate. Options include "left", "right", "up", "down".
- orientation
default: "horizontal"
type: string
description: Orient gallery vertically or horizontally.
- animation
default: "slide"
type: string
description: Type of animation for gallery. Options include "slide", "carousel", "book", "flip", "fade".
- speed
default: 2000
type: number
description: How much time (in milliseconds) each image will remain in place.
- timingfn
default: "ease-in-out"
type: string
description: css timing function for transitions.
- transitionspeed
default: 0.25
type: number
description: How fast the transitions are.
- playpause
default: false
type: boolean
description: Puts a play/pause button in the top left (while mouse is over gallery container).
- pauseonhover
default: false
type: boolean
description: If the gallery should pause while hovering.
- arrows
default: false
type: boolean
description: Puts arrow on the left and right of the gallery container (while mouse is over gallery container).
- advance
default: 1
type: number
description: How many images the gallery should advance every interval.
- startposition
default: "center"
type: string
description: Position of the first image in the gallery relative to other images in view. Options include "left", "right", "center".
- showcaptions
default: false
type: boolean
description: If caption
prop is supplied for each image, display caption over image.
- linkslides
default: false
type: boolean
description: If link
prop is supplied for each image, make image a clickable link.
- thumbnails
default: false
type: boolean
description: Displays thumbnails under gallery container. Brings corresponding image into view on click.
- contain
default: false
type: boolean
description: Sets background-size
of image to contain
.
- playIcon
default: "▶"
type: string
description: HTML to use for play button.
- pauseIcon
default: "⏸"
type: string
description: HTML to use for pause button.
- nextIcon
default: "›"
type: string
description: HTML to use for next button.
- prevIcon
default: "‹"
type: string
description: HTML to use for prev button.
- tag
default: "div"
type: string
description: Tag to use for images. Will use src
if img
is used. Else images will render as background-image
.
- imagePercentHigh
default: thumbnails ? 80 : 100
type: number
description: Percent of the height of the gallery container to use as the height of each image.
- thumbPercentHigh
default: thumbnails ? 15 : 0
type: number
description: Percent of the height of the gallery container to use as the height of each thumbnail.
- lbSmallPercentHigh
default: 30
type: number
description: Percent of the height of the gallery container to use as the height of each small lightbox image.
style
description: Style for to the gallery container.
thumbnailStyle
description: Style for to the thumbnails.
imgStyle
description: Style for to the images.
captionStyle
description: Style for to the captions.
lightboxStyle
description: Style for to full screen images when in lightbox mode.
controlStyle
description: Style for to the play/pause and next/prev buttons.
className
description: Class for the gallery container.
id
description: Id for the gallery container.
imgClass
description: Class for gallery images.
captionClass
description: Class for image captions.
thumbnailClass
description: Class for thumbnail images.
controlClass
description: Class for the play/pause and next/prev buttons.
examples
commonjs
1import Gallery from "react-gallery-designer"; 2 3const ids = [15, 20, 25, 30, 35, 40, 45, 50 , 55, 145, 150]; 4 5const images = ids.map((id, i) => ({ 6 src: `/imgs/IMG_${id}-1900.jpg`, 7 placeholder: `/imgs/IMG_${id}-100.jpg`, 8 srcset: `/imgs/IMG_${id}-1900.jpg 1900w, 9 /imgs/IMG_${id}-1200.jpg 1200w, 10 /imgs/IMG_${id}-768.jpg 768w, 11 /imgs/IMG_${id}-480.jpg 480w, 12 /imgs/IMG_${id}-300.jpg 300w`, 13 sizes: `(max-width: 320px) 320w, 14 (max-width: 480px) 480w, 15 (max-width: 768px) 768w, 16 (max-width: 1200px) 1200w, 17 1900px`, 18 link: `https://link-${id}.com`, 19 target: true, 20 index: i, 21 caption: `super cool caption ${i}`, 22 style: {borderRight: "red solid 10px"}, 23 repeat: true, 24 position: "bottom right", 25 children: "... some more children here ...", 26 alt: "SOOPERKEWLIMGOMG", 27 timeout: 500 28})); 29 30const settings = { 31 lightbox: false, 32 inview: 5, 33 auto: true, 34 noImages: false, 35 direction: "right", 36 orientation: "horizontal", 37 animation: "carousel", 38 speed: 3500, 39 timingfn: "linear", 40 transitionspeed: 0.333333, 41 playpause: true, 42 pauseonhover: true, 43 arrows: true, 44 advance: 2, 45 startposition: "right", 46 showcaptions: true, 47 linkslides: true, 48 thumbnails: true, 49 contain: true, 50 playIcon: "PLAY", 51 pauseIcon: "PAUSE", 52 nextIcon: "NEXT", 53 prevIcon: "PREV", 54 tag: "figure" 55}; 56 57const SuperCoolGallery = props => ( 58 <Gallery 59 {...props} 60 settings={settings} 61 images={images} 62 /> 63)
umd
see ./examples/umdLightbox.html
1<div id="react-gallery"></div> 2<script> 3 var ids = [ 4 15, 5 20, 6 25, 7 30, 8 35, 9 40, 10 45, 11 50, 12 55, 13 60, 14 65, 15 70, 16 75, 17 80, 18 85, 19 90, 20 95, 21 125, 22 130, 23 135, 24 140, 25 145, 26 150, 27 155, 28 160, 29 165, 30 170, 31 175, 32 180, 33 190, 34 195, 35 200 36 ]; 37 38 var imgs = ids.map(function(id, i) { 39 return { 40 src: `/imgs/IMG_${id}-1900.jpg`, 41 placeholder: `/imgs/IMG_${id}-100.jpg`, 42 srcset: `/imgs/IMG_${id}-1900.jpg 1900w, 43 /imgs/IMG_${id}-1200.jpg 1200w, 44 /imgs/IMG_${id}-768.jpg 768w, 45 /imgs/IMG_${id}-480.jpg 480w, 46 /imgs/IMG_${id}-300.jpg 300w`, 47 sizes: `(max-width: 320px) 320w, 48 (max-width: 480px) 480w, 49 (max-width: 768px) 768w, 50 (max-width: 1200px) 1200w, 51 1900px` 52 } 53 }); 54 55 var settings = { 56 lightbox: true 57 }; 58 59 return __RGD({ 60 images: imgs, 61 settings: settings, 62 style: { 63 width: "600px", 64 maxWidth: "95%", 65 margin: "0 auto" 66 }, 67 domId: "react-gallery" 68 }) 69 70</script>
Try Things Live
To test the options, git clone this repo, put some images in the 'imgs' directory, or grab them from whatever remote resource, and set-up your configuration. Then run yarn start ./relative/path/from/src/to/configuration
or npm run start ./relative/path/from/src/to/configuration
.
There are examples provided. To run them locally, execute yarn start ../examples/gallery-example
or npm run start ../examples/gallery-example
.
image credits
Thanks to my lovely wife Norah @ Fox & Folk for the images for the examples.
Contributing
clone, install, tinker, submit pr. Thanks!

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Reason
64 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-3wcq-x3mq-6r9p
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-pfq8-rq6v-vf5m
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5
- Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp
- Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq
- Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr
- Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765
- Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-c9g6-9335-x697
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More