
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
How to get it
- 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
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
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
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| PhotoSwipe (this) | 25.3k | Library | intermediate | 11 months ago | Web developers who want a photo gallery or lightbox on a site |
| Magnific-Popup | 11.3k | Library | beginner | 2.4 years ago | Maintaining an existing website that already uses Magnific Popup with jQuery |
| swiper | 41.9k | Library | intermediate | 6 days ago | Front-end developers adding a swipeable slider or image gallery to a website |
| image | 14.4k | Library | intermediate | 7 days ago | PHP developers who need to resize or convert uploaded images on a server |
| SDWebImage | 25.6k | Library | intermediate | 7 months ago | iOS or macOS app developers who need to show remote images in lists or grids |
| Kingfisher | 24.4k | Library | beginner | 4 days ago | iOS 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.