npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yet-rua-react-lightbox

v1.0.1

Published

Modern React lightbox component

Downloads

46

Readme

Yet RUA React Lightbox

A custom version. Fork from yet-another-react-lightbox

Added:

  • Swip pointer clientX and clientY in orientation portrait

Modern React lightbox component. Performant, easy to use, customizable and extendable.

Overview

  • Built for React: works with React 18, 17 and 16.8.0+
  • UX: supports keyboard, mouse, touchpad and touchscreen navigation
  • Preloading: never displays partially downloaded images
  • Performance: preloads limited number of images without compromising performance or UX
  • Responsive: responsive images with automatic resolution switching are supported out of the box
  • Video: video slides are supported via an optional plugin
  • Zoom: image zoom is supported via an optional plugin
  • Customization: customize any UI element or add your own custom slides
  • No bloat: never bundle rarely used features; add optional features via plugins
  • TypeScript: type definitions come built-in in the package
  • RTL: compatible with RTL layout

Yet Another React Lightbox | Example

Documentation

https://yet-another-react-lightbox.com/documentation

Examples

https://yet-another-react-lightbox.com/examples

Installation

npm install yet-another-react-lightbox

or

yarn add yet-another-react-lightbox

Minimal Setup Example

import * as React from "react";
import Lightbox from "yet-another-react-lightbox";
import "yet-another-react-lightbox/styles.css";

export default function App() {
    const [open, setOpen] = React.useState(false);

    return (
        <>
            <button type="button" onClick={() => setOpen(true)}>
                Open Lightbox
            </button>

            <Lightbox
                open={open}
                close={() => setOpen(false)}
                slides={[{ src: "/image1.jpg" }, { src: "/image2.jpg" }, { src: "/image3.jpg" }]}
            />
        </>
    );
}

Recommended Setup

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.

import * as React from "react";
import Lightbox from "yet-another-react-lightbox";
import "yet-another-react-lightbox/styles.css";

export default function App() {
    const [open, setOpen] = React.useState(false);

    return (
        <>
            <button type="button" onClick={() => setOpen(true)}>
                Open Lightbox
            </button>

            <Lightbox
                open={open}
                close={() => setOpen(false)}
                slides={[
                    {
                        src: "/image1x3840.jpg",
                        alt: "image 1",
                        width: 3840,
                        height: 2560,
                        srcSet: [
                            { src: "/image1x320.jpg", width: 320, height: 213 },
                            { src: "/image1x640.jpg", width: 640, height: 427 },
                            { src: "/image1x1200.jpg", width: 1200, height: 800 },
                            { src: "/image1x2048.jpg", width: 2048, height: 1365 },
                            { src: "/image1x3840.jpg", width: 3840, height: 2560 },
                        ],
                    },
                    // ...
                ]}
            />
        </>
    );
}

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.

Plugins

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:

  • Captions - adds support for slide title and description
  • Counter - adds slides counter
  • Download - adds download button
  • Fullscreen - adds support for fullscreen mode
  • Inline - transforms the lightbox into an image carousel
  • Share - adds sharing button
  • Slideshow - adds slideshow button
  • Thumbnails - adds thumbnails track
  • Video - adds support for video slides
  • Zoom - adds image zoom feature

License

MIT © 2022 Igor Danchenko