Skip to content

PhotoSwipe

A JavaScript image gallery and lightbox that works on mobile and desktop and is not tied to any framework.

Stars
25.3k
Forks
3.3k
Licence
MIT
Language
JavaScript
Last update
11 months ago
Type
Library

What it is

PhotoSwipe is a JavaScript library that shows images in a full-screen lightbox overlay, the kind of viewer you open when you click a photo on a website. It is described as modular and framework independent, so it can be added to a page without a specific framework like React or Vue. The README points to a demo and documentation on the project website.

  • Add a click-to-enlarge lightbox to a product or portfolio page
  • Show a set of photos in a full-screen swipeable viewer on a phone
  • Build a gallery on a site that uses plain HTML and JavaScript

Great for

  • Web developers who want a photo gallery or lightbox on a site
  • Sites that need touch and mobile-friendly image viewing
  • Projects that do not use a particular JavaScript framework
  • Teams that want a permissively licensed (MIT) dependency

Not ideal for

  • People who need a no-code tool; this requires writing and building JavaScript
  • Projects that need the old v4 API; the README points to v4 docs separately and describes v5 as current
  • Anyone needing features not described in the README; the README gives few details on specific capabilities
Step-by-step guide: how to use PhotoSwipeInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js and npm (for building from source or the demo website)

    Build JS and CSS in dist/ from the repository root

    npm run build
  2. 2

    Run it

    • Read the getting-started guide at photoswipe.com/getting-started/
    • Include the built files from dist/ in your web page
    • Initialize a gallery with the library's API as described in the documentation
  3. 3

    Get the most out of it

    • Use the demo website in demo-docs-website/ to see examples and manual tests
    • Run npm run watch during development to rebuild automatically
    • Read the docs folder in the repository for detailed markdown documentation

Downloads

Strengths

  • Framework independent, per the project description
  • MIT licensed and widely starred (about 25,000 stars at time of metadata)
  • Documentation and a demo site are linked from the README

Trade-offs

  • The README is short on feature detail, so specifics must be checked on the documentation site
  • The README announces a new major version (v6) in development, so long-term API plans may change
  • Setup requires a build step via npm, which is less friendly for non-developers

How it compares

ProjectStarsTypeLevelUpdatedBest for
PhotoSwipe (this)25.3kLibraryintermediate11 months agoWeb developers who want a photo gallery or lightbox on a site
Magnific-Popup11.3kLibrarybeginner2.4 years agoMaintaining an existing website that already uses Magnific Popup with jQuery
swiper41.9kLibraryintermediate7 days agoFront-end developers adding a swipeable slider or image gallery to a website
image14.4kLibraryintermediate7 days agoPHP developers who need to resize or convert uploaded images on a server
SDWebImage25.6kLibraryintermediate7 months agoiOS or macOS app developers who need to show remote images in lists or grids
Kingfisher24.4kLibrarybeginner4 days agoiOS or macOS developers who need to show remote images in lists or detail screens

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.