A simple example of a scrollable image grid using Material UI in ReactJS. We had a requirement for a scrollable image grid which will load images lazily. We started with the Grid List example provided in Material UI.
We added a few more capabilities
- Load images lazily
- On clicking the tile, bigger size image is displayed with download option.
Few screenshots of the image grid
- Image Grid
- Expaned Image
We also used React Infinite Scroller which is a simple, lightweight infinite scroll package that supports both window and scrollable elements.
The image metadata array provided is hardcoded in the example code. This can be passed to the imagegrid component as a prop and fetched from your application’s api endpoint. We store the metadata in our database and actual images in different resolutions are stored in Amazon S3.
Complete code is checked in at GitHub.
You can play around with at CodeSandbox
Author Manish Prasad