react-spring-lightbox
React-spring-lightbox is a flexible image gallery lightbox with native-feeling touch gestures and buttery smooth animations.
✨ Features
- :point_up:
Mousewheel
, swipe or click+drag to page photos - :keyboard: Keyboard controls ← → Esc
- :mouse2: Ctrl +
Mousewheel
orTrackpad Pinch
to zoom - :mag_right: Double/Single-tap or double/single-click to zoom in/out
- :ok_hand: Pinch to zoom
- :point_left: Panning on zoomed-in images
- :checkered_flag: Highly performant spring based animations via react-spring
- No external CSS
- Implement your own UI
- Supports IE 11, Edge, Safari, Chrome, Firefox and Opera
Install
Usage
Props
Prop | Description |
---|---|
isOpen | Flag that dictates if the lightbox is open or closed |
onClose | Function that closes the Lightbox |
onPrev | Function that changes currentIndex to previous image in images |
onNext | Function that changes currentIndex to next image in images |
currentIndex | Index of image in images array that is currently shown |
renderHeader | A React component that renders above the image pager |
renderFooter | A React component that renders below the image pager |
renderPrevButton | A React component that is used for previous button in image pager |
renderNextButton | A React component that is used for next button in image pager |
renderImageOverlay | A React component that renders within the image stage, useful for creating UI overlays on top of the current image |
singleClickToZoom | Overrides the default behavior of double clicking causing an image zoom to a single click |
images | Array of image objects to be shown in Lightbox |
className | Classes are applied to the root lightbox component |
style | Inline styles are applied to the root lightbox component |
pageTransitionConfig | React-Spring useTransition config for page open/close animation |
Local Development
Clone the repo
Setup symlinks
Run the library in development mode
Run the example app in development mode
Changes to the library code should hot reload in the demo app