OSS TanbouSign in with GitHub

open image galleries in a lightbox with swipe, zoom, and dynamic loading across mobile and desktop

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
25,270
Primary language
JavaScript
License
MIT
Repository last updated
Dec 4, 2025
On this page

Overview

PhotoSwipe is a JavaScript image gallery and lightbox for mobile and desktop. Its Core, Lightbox, and CSS are separated so thumbnail galleries can open large images with swipe and zoom interactions without requiring a frontend framework.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Split Lightbox and Core so the gallery engine can load on demand

The recommended setup lets PhotoSwipeLightbox watch gallery clicks and dynamically import Core through pswpModule, keeping the initial bundle smaller until the gallery is opened.

Sources: [2]

Use existing links and thumbnails as the gallery data source

Configure a ギャラリーcontainer and children selector, then provide the image URL plus data-pswp-width and data-pswp-height on each link. A thumbnail image can live inside the same link.

Sources: [2]

Build around レスポンシブ画像s and progressive enhancement

The official guide recommends レスポンシブ画像s and expects content to remain reachable through normal image links even when PhotoSwipe does not run.

Sources: [2]

Best fit

Fits photo galleries, portfolios, and product imagery across touch and desktop interfaces

It is useful when thumbnail grids should open into a consistent swipe- and zoom-capable viewing experience across devices.

Sources: [1][2]

Before adoption

Every image needs known width and height before opening

PhotoSwipe requires image dimensions in advance and documents data-pswp-width and data-pswp-height on gallery links, so 動的content needs a dimension-metadata strategy.

Sources: [2]

Avoid serving extremely large source images directly

The guide says PhotoSwipe is not designed for very large images and recommends レスポンシブ画像s, with roughly 3000x3000px as the usual maximum recommendation unless a tiling approach is used.

Sources: [2]

Official sources

  1. [1]PhotoSwipe v5.4.4 README(2026-10-05)
  2. [2]PhotoSwipe v5.4.4 Getting Started(2026-10-05)
  3. [3]PhotoSwipe v5.4.4 package metadata(2026-10-05)
  4. [4]PhotoSwipe v5.4.4 release(2026-10-05)
  5. [5]PhotoSwipe MIT license(2026-10-05)
Supplemental curator note

PhotoSwipe's Core/Lightbox split allows the heavier Core module to be loaded only when the gallery opens. Because each image needs known width and height, CMS or API integrations should plan how those dimensions are stored and delivered.

Try it in 3 steps

  1. 1

    Install PhotoSwipe 5.4.4

    Pin the reviewed stable v5 release.

    npm install --save-exact photoswipe@5.4.4
  2. 2

    Create gallery markup with image dimensions

    Provide the large image URL and required data-pswp-width and data-pswp-height attributes on each link.

    <div id="my-gallery"><a href="large.jpg" data-pswp-width="1600" data-pswp-height="1200"><img src="thumb.jpg" alt=""></a></div>
  3. 3

    Initialize PhotoSwipeLightbox

    Let Lightbox dynamically load Core when needed and open gallery links in PhotoSwipe.

    import PhotoSwipeLightbox from 'photoswipe/lightbox'; import 'photoswipe/style.css'; const lightbox = new PhotoSwipeLightbox({ gallery: '#my-gallery', children: 'a', pswpModule: () => import('photoswipe') }); lightbox.init();
Check the official README

Growth

Growth trends · Last 30 days

25,270 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
0
Open PRs
8

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • gallery
  • lightbox
  • image
  • javascript
Stars
25,270
Forks
3,271
Watchers
521
Open issues
162
Contributors
70
Owner type
User
Primary language
JavaScript
License
MIT
Repository last updated
Dec 4, 2025
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?