Socket
Socket
Sign inDemoInstall

react-image-video-lightbox

Package Overview
Dependencies
4
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
1.8K
decreased by-5.51%
Maintainers
1
Install size
89.6 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 06 Apr 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc