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

payload-media-gallery

v0.1.1

Published

A Payload CMS 3.x plugin that replaces the default upload-collection list with a visual grid gallery, lightbox, drag-and-drop bulk upload, and metadata sidebar.

Readme

payload-media-gallery

A Payload CMS 3.x plugin that replaces the default table view of an upload collection with a visual grid gallery.

Features

  • Responsive grid of thumbnails for any upload collection
  • Lightbox modal with keyboard navigation (←/→, Esc) and per-page paging
  • Drag-and-drop bulk upload (anywhere on the gallery surface)
  • Metadata sidebar with filename, format, size, dimensions, dates
  • Collapsible "Preview sizes" accordion listing every generated image size
  • Inline delete with confirmation
  • Bulk select via per-card checkboxes (uses Payload's built-in selection state)
  • Field picker drawer support — works as a relationship picker in other collections
  • Themed via Payload's --theme-elevation-* CSS variables, plus an optional --media-gallery-accent override

Requirements

  • Payload ^3.0.0
  • React ^19.0.0, React DOM ^19.0.0
  • Next.js ^15 or ^16
  • An upload-enabled collection

Installation

pnpm add payload-media-gallery
# or
npm install payload-media-gallery
# or
yarn add payload-media-gallery

Usage

Add the plugin to your payload.config.ts and pass the slug of the upload collection you want to attach the gallery to:

import { buildConfig } from 'payload'
import { mediaGalleryPlugin } from 'payload-media-gallery'

export default buildConfig({
  collections: [
    {
      slug: 'media',
      upload: true,
      fields: [
        { name: 'alt', type: 'text' },
      ],
    },
    // ... your other collections
  ],
  plugins: [
    mediaGalleryPlugin({
      collectionSlug: 'media',
    }),
  ],
})

After installing, regenerate the Payload import map:

pnpm payload generate:importmap

This also runs automatically on next dev and next build.

Options

| Option | Type | Required | Description | | --- | --- | --- | --- | | collectionSlug | string | yes | The slug of the upload collection the gallery should replace the default list for. |

Theming

The gallery inherits Payload's neutral theme colors by default. To customize the accent color (selection highlight, checkbox, hover borders, link color), set a CSS custom property anywhere in your admin styles:

:root {
  --media-gallery-accent: #b1852f;
}

How it works

The plugin attaches a beforeListTable admin component to the configured collection and registers a small REST endpoint at /api/media-gallery/delete for the lightbox delete action. It does not modify your collection's schema, hooks, or access control.

Local development

This repo includes a dev/ sandbox — a minimal Payload + Next.js app that imports the plugin via workspace path so you can iterate with HMR and an in-memory MongoDB.

pnpm install
cp dev/.env.example dev/.env
# edit dev/.env and set PAYLOAD_SECRET to anything

pnpm dev

Open http://localhost:3000/admin. The seeded login is [email protected] / test.

The sandbox uses mongodb-memory-server by default — no Mongo install needed. To use a real Mongo instance, set DATABASE_URL in dev/.env.

Building for publish

pnpm build

This runs copyfiles (assets like SCSS), tsc (type declarations), and swc (JS) to produce the dist/ folder consumed by the publishConfig exports.

License

MIT — see LICENSE.