Single image fills container #67
-
I'm using the masonry layout for showing thumbnails. It works great if there are 3 or more images, but in some instances we only have one image. As it's a thumbnail (maximum height or width of 200px), its resolution is very low but it fills the container and of course looks blocky. I tried setting This library seems very fully featured so I'm sure I'm missing something...? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Update (Dec 2022): the below answer is relevant to v1 of the library. v2 implements the desired behavior by default. Hi there! Thank you for the great question! You haven't missed any setting here, as this is the intended library behavior. The library intentionally opts to render fewer columns when there aren't enough photos to fill all the columns. There are multiple approaches to tackle this issue, and I'm leaving this decision to the library users. Here are some approaches you can consider (all of them provide slightly different UX and have their tradeoffs):
Here is a draft you can use as an inspiration - https://codesandbox.io/s/18d0st I hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Hi, I have a same question, but I use row layout. And for one picture its height is much more than P.S. I use v2 |
Beta Was this translation helpful? Give feedback.
Update (Dec 2022): the below answer is relevant to v1 of the library. v2 implements the desired behavior by default.
Hi there!
Thank you for the great question! You haven't missed any setting here, as this is the intended library behavior. The library intentionally opts to render fewer columns when there aren't enough photos to fill all the columns. There are multiple approaches to tackle this issue, and I'm leaving this decision to the library users.
Here are some approaches you can consider (all of them provide slightly different UX and have their tradeoffs):
Limit parent container width. The gallery utilizes 100% of its parent's horizontal space, so you can wrap it in a div and limi…