Skip to content

MediaGrid

Experimental

A gallery of images in even rows that adjusts to the screen, with optional selecting and an empty message.

Also known as gallery, image gallery, masonry, photo grid

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Gallery

6 images

  • Harbor at low tide with three boats
  • Terraced hillside with a path
  • Quiet street with a bakery sign
  • Lake under an overcast sky
  • Greenhouse interior with rows of seedlings
  • Market stall with baskets of apples

Every image has the same shape, so rows stay even.

When to use it

Lays out many images in even rows with one gap and one shape, so they are easy to scan. It can let people pick several, and shows an empty message when there is nothing.

Made of: Count line · Grid · Image tile · Select button · Empty message

Use it for

  • A gallery of uploads or generated images.
  • Picking several images to download, delete or reuse: turn on selectable.

Not for

Do and avoid

4 images

  • Harbor at low tide with three boats
  • Terraced hillside with a path
  • Quiet street with a bakery sign
  • Lake under an overcast sky
Do. Even rows of the same shape are quick to scan.

1 image

  • Harbor at low tide with three boats
Avoid. A grid for one image leaves empty space and adds nothing.

Do

  • Give the grid a name that says what the images are.
  • Use one shape for the whole grid.
  • Replace the empty message when you know the reason, such as a filter.

Avoid

  • Do not mix shapes in one grid.
  • Do not show what is chosen with color alone. The check mark does that.
  • Do not use it for a single image. Use MediaFrame.

On a phone

  • The grid is two columns on a phone, and three or four only from the md and xl breakpoints.
  • In select mode, each check button sits in the top right corner of the image. On touch screens it keeps its 28px size and has a 44px by 44px tap area.
  • The count line is 12px text above the grid, and it is announced as a status when the count changes.

Seen in products

  • No authoritative source was reached for gallery layouts. The shared ratio, column steps and selection pattern are Tattva decisions.
  • The empty state follows the Carbon and Shopify guidance recorded on the EmptyState entry.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started