🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-image-video-lightbox

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-image-video-lightbox

A React lightbox that supports videos, images and pinch zooming on images. Optimized for mobile UI with swiping, but can be used on desktop as well.

3.0.1
latest
Source
npm
Version published
Weekly downloads
1.1K
-5.49%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

lightbox

FAQs

Package last updated on 06 Apr 2023

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