3.0.1 • Published 12 months ago

react-image-video-lightbox v3.0.1

Weekly downloads
1,505
License
MIT
Repository
github
Last release
12 months ago

React image & video lightbox

View demo

Installation

npm install react-image-video-lightbox

Usage

<ReactImageVideoLightbox
  data={[
    {
      url: "https://placekitten.com/450/300",
      type: "photo",
      altTag: "some image",
    },
    {
      url: "https://www.youtube.com/embed/ScMzIvxBSi4",
      type: "video",
      title: "some video",
    },
    {
      url: "https://placekitten.com/550/500",
      type: "photo",
      altTag: "some other image",
    },
    {
      url: "https://www.youtube.com/embed/ScMzIvxBSi4",
      type: "video",
      title: "some other video",
    },
  ]}
  startIndex={0}
  showResourceCount={true}
  onCloseCallback={this.callbackFunction}
  onNavigationCallback={(currentIndex) =>
    console.log(`Current index: ${currentIndex}`)
  }
/>

Properties

PropertyTypeDescription
dataArray of resourcesAn array of resource objects (see resource object below)
startIndexnumberIndex of image/video where the lightbox should open
showResourceCountbooleanShow resource count in the upper left corner
onCloseCallbackFunction => voidCallback function called when the lightbox is closed
onNavigationCallbackFunction(currentIndex) => voidCallback function called on navigation between resources

Resource Object

PropertyTypeDescription
urlstringUrl of the image/video
typestringTwo types are supported - 'photo' & 'video' (only YouTube videos are supported)
altTagstringAlt tag for image
titlestringTitle for iframe when rendering YouTube video

Have a feature request or suggestion?

Create an issue on Github: https://github.com/Ngineer101/react-image-video-lightbox/issues

3.0.1

12 months ago

3.0.0-rc2.1

3 years ago

3.0.0-rc1

3 years ago

3.0.0

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago