Every React project I’ve worked on eventually needs a gallery, and every time the same thing happens. Someone searches npm, finds forty packages called some variation of “react gallery”, and picks the the one with the most stars. Half of those are carousels, not lightboxes. A few are wrappers around a DOM library that fight React for control of the page. And a couple are genuinely great, as long as you want exactly what they do.
So I went through the ones people actually install and asked the questions that end up deciding it in practice. Is it a real React component or a wrapper? Does it do thumbnails and video, or just images? How does it feel on a phone? Can I make it look like part of my site instead of a plugin? Will it render on the server in Next.js without a dynamic() wrapper? And what does the license let you do? The numbers come straight from npm and GitHub, and the opinions are mine.
The seven at a glance
| Feature | lightGallery | React Image Gallery | PhotoSwipe | React Photo View | Swiper | Keen Slider | React Slick |
|---|---|---|---|---|---|---|---|
| Setup | |||||||
| Native React component | Init in an effect Partly: | Wraps the core Partly: | Hook Yes: | ||||
| Server rendering | Triggers only Partly: | ||||||
| Lightbox overlay | Fullscreen mode Partly: | ||||||
| Media | |||||||
| Thumbnail strip | Second slider Partly: | Second slider Partly: | |||||
| Video slides | YouTube, Vimeo, Wistia, HTML5 Yes: | HTML5 plugin Partly: | |||||
| Lazy video embeds | |||||||
| Video thumbnails fetched for you | |||||||
| Iframe slides, maps and PDFs | |||||||
| Responsive images, srcset and picture | |||||||
| Captions | Plugin Partly: | ||||||
| Interaction | |||||||
| Pinch and double-tap zoom | |||||||
| Swipe or pinch to close | |||||||
| Opens from the thumbnail | |||||||
| Thumbnail scrubbing | |||||||
| Fullscreen | |||||||
| Keyboard navigation | |||||||
| Screen reader support | Dialog, announcements Yes: | ||||||
| Reduced motion | |||||||
| Layout and scale | |||||||
| Justified grid | |||||||
| Virtualization | |||||||
| Right-to-left | |||||||
| Custom icons | |||||||
| Links and sharing | |||||||
| Deep links, back and forward | |||||||
| Native share sheet | |||||||
| Project | |||||||
| Core size, gzipped | 19 KB | 10 KB | 17 KB | 8 KB | 20 KB | 6 KB | 15 KB and CSS |
| Last release | Oct 2026 | Feb 2026 | May 2024 | Jan 2025 | Sep 2026 | Jul 2023 | Aug 2025 |
| License | GPLv3 or commercial | MIT | MIT | Apache-2.0 | MIT | MIT | MIT |
lightGallery
I’ll start with the one I know best. The thing to understand about lightGallery is that @lightgallery/react is a real component now, not a wrapper. React renders the grid and the lightbox, the same core drives the Vue and Angular packages, and the grid server-renders as plain markup, so Next.js is happy without any dynamic() tricks. The lightbox portal only mounts after hydration.
Everything that isn’t the core lightbox is a plugin with its own import. That covers thumbnails, zoom, video, autoplay, fullscreen, share, rotate, hash URLs, a justified grid, and so on. The core is about 19 KB gzipped, zoom adds about 7 KB, and whatever you don’t import never touches your bundle. The vanilla package alone sees around 100,000 npm downloads a week.
On a phone it behaves like a photos app. Swipe between slides, pinch or double tap to zoom, drag or pinch to close, and every fling keeps the speed you let go at and settles in a spring instead of snapping to a stop. Edges resist with friction, and reduced-motion turns all of it off. It’s the best touch experience on this list, and I’d say that even if it weren’t ours.
It also looks finished out of the box, which matters more than it sounds for something that frames other people’s photos. The chrome is restrained, the toolbar stays on one row and folds its least important buttons into a menu when space runs out, and every icon is an inline SVG that takes the button’s color, so recoloring the whole set is one CSS rule. Past that, a render slot swaps any icon by name, there are twenty-odd slide transitions plus your own easing, captions take any HTML, and a className on the gallery scopes your own styles to it. Restyling is still CSS, same as everywhere, but the defaults mean you rarely need much of it.
import { LightGallery, LightGalleryItem } from '@lightgallery/react';
import Thumbnail from '@lightgallery/react/plugins/thumbnail';
import Zoom from '@lightgallery/react/plugins/zoom';
const items = [
{ src: 'img/1-1600.jpg', thumb: 'img/1-240.jpg', alt: 'Mountains', lgSize: '1600-1067' },
{ src: 'img/2-1600.jpg', thumb: 'img/2-240.jpg', alt: 'Forest path', lgSize: '1600-2400' },
];
export function Gallery() {
return (
<LightGallery plugins={[Thumbnail, Zoom]}>
{items.map((item) => (
<LightGalleryItem key={item.src} item={item} href={item.src}>
<img src={item.thumb} alt={item.alt} />
</LightGalleryItem>
))}
</LightGallery>
);
}
Pick it if you want thumbnails, video, zoom and a proper touch experience from one component, if your team also ships Vue or Angular, or if you’re on Next.js and care about the grid being in the HTML.
The honest downside is the license. It’s free under the GPLv3, which is fine for open source, but a proprietary codebase needs a one-time commercial license. You also need the full-size image dimensions (lgSize) if you want the open-from-thumbnail animation, which can be a nuisance with images from an API that doesn’t give you sizes.
React Image Gallery
React Image Gallery is the one I reach for when a client says “like a product page”, meaning an inline carousel with a row of thumbnails underneath and a fullscreen button. Swipe, keyboard, RTL and autoplay are all there, and any slide can be a custom render, which is how you get video in.
What it isn’t is a lightbox. Fullscreen mode is the carousel scaled up, not a seperate overlay, and there’s no pinch or double-tap zoom. If you need either, you’ll be adding a second library. Styling past the default theme also means overriding it’s CSS, which is fine for a few tweaks and tedious for a redesign.
PhotoSwipe
PhotoSwipe has the best touch feel of the image-only libraries here. Pinch zoom, double tap and the drag-down-to-close gesture all feel like a native photos app. It’s framework-free, so from React you create it in a useEffect and point it at your own grid markup. There’s no official component, just the documented pattern.
That’s also the catch. Because it touches the DOM directly, it has to be initialised on the client only, and because it’s images-first, video and a thumbnail strip are both things you add yourself. It also wants the full-size width and height of every image up front. If you only ever show photos and want good gestures in a small package, none of that will bother you.
React Photo View
React Photo View is a small native viewer, about 7 KB gzipped, with pinch zoom, drag-and-pan that bounces at the edges, keyboard navigation and server rendering. You wrap the page’s images in PhotoProvider and PhotoView and you’re done. A custom node, such as a video element, can be a slide too.
I’d use it for images in articles or feeds where you don’t want a whole gallery system. There’s no thumbnail strip and no video providers, and features like fullscreen or rotation are things you build from custom nodes rather than switch on.
Swiper
Swiper is the most capable carousel engine around, and its React components sit on top of it. Thumbnails come from the Thumbs module, pinch zoom from the Zoom module, and there are modules for pagination, navigation, parallax and virtual slides. If your slider has unusual behaviour, Swiper can probably do it.
It’s a carousel, though, not a lightbox, so the full-screen view is yours to add, and it’s heavy for a simple gallery. One more thing worth knowing is that the Swiper team now recommends their web components over the React components for new work.
Keen Slider
Keen Slider is the headless option, at about 6 KB gzipped with no styles at all and a useKeenSlider hook that gives you the slider state and leaves every pixel of markup to you. Thumbnails are a second slider linked to the first, which the docs show how to do.
If you’re designing a carousel from scratch and want nothing imposed on you, it’s lovely. If you want a lightbox, zoom or a thumbnail strip out of the box, it’s the wrong tool, because each of those is your own code.
React Slick
React Slick is the React port of the Slick carousel, which means responsive breakpoints, autoplay, lazy loading, infinite loop and the asNavFor trick that links two sliders into a thumbnail row. It has been around so long that nearly every layout question already has a Stack Overflow answer.
It also depends on the jQuery-era CSS from slick-carousel, has no lightbox or zoom, and gets fewer updates than anything else here. I’d only pick it for a team already on Slick. If that’s you, the Slick slider with lightbox demo shows how to pair it with a lightbox for the full-screen view.
So which one?
- lightGallery if you want one component that does grid, lightbox, thumbnails, video and zoom.
- React Image Gallery if you want an inline slider with thumbnails and nothing modal, or Swiper if you need more control.
- PhotoSwipe or React Photo View if you only show images and want good gestures in the smallest package.
- Keen Slider if you want to design the carousel yourself.
- React Slick if you’re already on Slick, plus a lightbox for full-screen.
If lightGallery is the pick, the React image gallery demo, the Next.js guide and the React package docs are where I’d start.
lightGallery