Gathering detailed insights and metrics for @danielmoraes/yet-another-react-lightbox
Gathering detailed insights and metrics for @danielmoraes/yet-another-react-lightbox
Gathering detailed insights and metrics for @danielmoraes/yet-another-react-lightbox
Gathering detailed insights and metrics for @danielmoraes/yet-another-react-lightbox
Modern React lightbox component
npm install @danielmoraes/yet-another-react-lightbox
Typescript
Module System
Min. Node Version
Node Version
NPM Version
73.3
Supply Chain
94.5
Quality
76.5
Maintenance
100
Vulnerability
100
License
TypeScript (92.29%)
SCSS (4.67%)
JavaScript (2.11%)
CSS (0.62%)
HTML (0.26%)
Shell (0.05%)
Total Downloads
34,329
Last Day
317
Last Week
1,758
Last Month
5,136
Last Year
33,627
MIT License
340 Commits
8 Branches
2 Contributors
Updated on Jun 07, 2024
Minified
Minified + Gzipped
Latest Version
1.1.0
Package Id
@danielmoraes/yet-another-react-lightbox@1.1.0
Unpacked Size
218.28 kB
Size
46.87 kB
File Count
38
NPM Version
10.8.1
Node Version
20.14.0
Published on
Jun 07, 2024
Cumulative downloads
Total Downloads
Last Day
188.2%
317
Compared to previous day
Last Week
55.3%
1,758
Compared to previous week
Last Month
27.5%
5,136
Compared to previous month
Last Year
4,690.2%
33,627
Compared to previous year
Modern React lightbox component. Performant, easy to use, customizable and extendable.
https://yet-another-react-lightbox.com/documentation
https://yet-another-react-lightbox.com/examples
1npm install yet-another-react-lightbox
or
1yarn add yet-another-react-lightbox
1import * as React from "react"; 2import Lightbox from "yet-another-react-lightbox"; 3import "yet-another-react-lightbox/styles.css"; 4 5export default function App() { 6 const [open, setOpen] = React.useState(false); 7 8 return ( 9 <> 10 <button type="button" onClick={() => setOpen(true)}> 11 Open Lightbox 12 </button> 13 14 <Lightbox 15 open={open} 16 close={() => setOpen(false)} 17 slides={[{ src: "/image1.jpg" }, { src: "/image2.jpg" }, { src: "/image3.jpg" }]} 18 /> 19 </> 20 ); 21}
Unlike many other lightbox libraries, Yet Another React Lightbox doesn't have a concept of "thumbnail" or "original"
(or "full size") images. We use responsive images instead and recommend you provide multiple files of different
resolutions for each image. Yet Another React Lightbox automatically populates srcset
/ sizes
attributes and lets
the browser decide which image is more appropriate for its viewport size.
1import * as React from "react"; 2import Lightbox from "yet-another-react-lightbox"; 3import "yet-another-react-lightbox/styles.css"; 4 5export default function App() { 6 const [open, setOpen] = React.useState(false); 7 8 return ( 9 <> 10 <button type="button" onClick={() => setOpen(true)}> 11 Open Lightbox 12 </button> 13 14 <Lightbox 15 open={open} 16 close={() => setOpen(false)} 17 slides={[ 18 { 19 src: "/image1x3840.jpg", 20 alt: "image 1", 21 width: 3840, 22 height: 2560, 23 srcSet: [ 24 { src: "/image1x320.jpg", width: 320, height: 213 }, 25 { src: "/image1x640.jpg", width: 640, height: 427 }, 26 { src: "/image1x1200.jpg", width: 1200, height: 800 }, 27 { src: "/image1x2048.jpg", width: 2048, height: 1365 }, 28 { src: "/image1x3840.jpg", width: 3840, height: 2560 }, 29 ], 30 }, 31 // ... 32 ]} 33 /> 34 </> 35 ); 36}
You can also integrate 3rd-party image components (e.g., Next.js Image or Gatsby Image) via a custom render function. See examples on the documentation website.
Yet Another React Lightbox allows you to add optional features to your project based on your requirements via plugins.
The following plugins are bundled in the package:
MIT © 2022 Igor Danchenko
No vulnerabilities found.
No security vulnerabilities found.