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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-spotlight-gallery

v0.1.3

Published

React + TypeScript wrapper for Spotlight.js with original interactions and effects

Readme

react-spotlight-gallery

React + TypeScript wrapper for Spotlight.js.

Install

npm install react-spotlight-gallery

Import styles once (app entry or layout):

import 'react-spotlight-gallery/style.css';

Declarative usage

import { SpotlightGroup, SpotlightItem } from 'react-spotlight-gallery';
import 'react-spotlight-gallery/style.css';

<SpotlightGroup options={{ fit: 'cover', autohide: 'all' }}>
  <SpotlightItem href="/gallery/photo.jpg" options={{ title: 'Title', description: 'Description' }}>
    <img src="/gallery/thumb.jpg" alt="Title" />
  </SpotlightItem>
  <SpotlightItem href="/gallery/photo2.jpg">
    <img src="/gallery/thumb2.jpg" alt="Photo 2" />
  </SpotlightItem>
</SpotlightGroup>

SpotlightGroupdiv.spotlight-group
SpotlightItem<a class="spotlight"> (or <div> via as="div")

SpotlightGroup props

| Prop | Type | Description | |---|---|---| | options | SpotlightGroupOptions | Gallery-level options | | className | string | Extra CSS class | | ...rest | HTMLAttributes<HTMLDivElement> | Any div attribute |

SpotlightItem props

| Prop | Type | Description | |---|---|---| | href | string | Full image URL — renders as <a> | | options | SpotlightItemOptions | Per-slide options | | as | 'a' \| 'div' | Override tag (default: 'a' if href, else 'div') | | ...rest | HTMLAttributes | Any element attribute |

Programmatic usage

import { Spotlight } from 'react-spotlight-gallery';

Spotlight.show(
  [
    { src: '/gallery/1.jpg', title: 'Slide 1', description: 'Description' },
    { src: '/gallery/2.jpg', title: 'Slide 2' },
  ],
  {
    control: ['page', 'fullscreen', 'close', 'prev', 'next'],
    infinite: true,
    fit: 'cover',
  }
);

Options

SpotlightItemOptions

| Option | Type | Default | Description | |---|---|---|---| | src | string \| HTMLElement | — | Image URL or DOM node | | media | 'image' \| 'video' \| 'node' | 'image' | Media type | | title | string \| false | — | Slide title | | description | string \| false | — | Slide description | | fit | 'contain' \| 'cover' | 'cover' | Image fit | | theme | string \| false | — | 'white' or default dark | | animation | string \| string[] | — | 'slide', 'fade', 'scale', 'custom', or array | | control | string \| string[] | — | Toolbar buttons (see below) | | autohide | boolean \| number \| 'all' | true | false = always visible, true = hide after inactivity, 'all' = hide arrows too | | infinite | boolean | false | Wrap around at ends | | preload | boolean | false | Preload next slide | | spinner | boolean | true | Loading spinner | | autoplay | boolean | false | Video autoplay | | autoslide | boolean \| number | false | Auto-advance in ms | | poster | string | — | Video poster image | | button | string \| false | — | Custom button label | | buttonHref | string | — | Custom button href or JS | | download | boolean | false | Download button | | zoom | boolean | false | Enable zoom | | zoom-in | boolean | false | Zoom in button | | zoom-out | boolean | false | Zoom out button | | progress | boolean | false | Progress bar |

SpotlightGroupOptions

Extends SpotlightItemOptions plus:

| Option | Type | Description | |---|---|---| | index | number | Slide to open (1-based) | | onshow | (index: number) => void | Gallery opened | | onclose | (index?: number) => void | Gallery closed | | onchange | (index: number, options) => void | Slide changed | | onclick | (index: number, options) => void | Slide clicked |

control values

String or array of: 'info', 'page', 'theme', 'fullscreen', 'autofit', 'zoom-in', 'zoom-out', 'close', 'download', 'play', 'prev', 'next'

control: ['page', 'close', 'prev', 'next']

Arrows

The side arrows (.spl-prev / .spl-next) appear when the toolbar is visible.

// arrows always visible
{ autohide: false }

// arrows hide with toolbar after inactivity
{ autohide: true }

// prev/next also as toolbar buttons
{ control: ['prev', 'next', 'close'] }

API

Spotlight.show(gallery, options?, index?)
Spotlight.close()
Spotlight.next()
Spotlight.prev()
Spotlight.goto(slide)          // 1-based
Spotlight.zoom(factor?)
Spotlight.fullscreen(state?)
Spotlight.autofit(state?)
Spotlight.menu(state?)
Spotlight.play(state?)
Spotlight.theme(value?)
Spotlight.download()
Spotlight.addControl(name, fn) // returns the button element
Spotlight.removeControl(name)

Video

<SpotlightItem
  options={{
    media: 'video',
    'src-mp4': 'https://example.com/video.mp4',
    'src-webm': 'https://example.com/video.webm',
    autoplay: false,
    poster: 'gallery/poster.jpg',
  }}
>
  <img src="gallery/poster.jpg" alt="Video" />
</SpotlightItem>

Embed HTML (node)

<SpotlightItem options={{ media: 'node', src: '#content' }}>
  <img src="thumb.jpg" alt="" />
</SpotlightItem>

<div style={{ display: 'none' }}>
  <div id="content">
    <p>Any HTML here</p>
  </div>
</div>

Custom controls

Spotlight.show(gallery, {
  onshow() {
    Spotlight.addControl('like', function() {
      console.log('liked!');
    });
  },
  onclose() {
    Spotlight.removeControl('like');
  },
});

Next.js

Add 'use client' to any component using this library.