# <masonry>

Balanced columns: each child goes into the shortest column so far, like a photo feed.

Category: Layout.

```ham
<masonry columns="2"
         spacing="8"
         run-spacing="8">
    <img src="https://hypeapps.dev/gallery/assets/landscape.jpg"
         style="w-full h-160 rounded-lg"
         fit="cover"/>
    <img src="https://hypeapps.dev/gallery/assets/person1.jpg"
         style="w-full h-220 rounded-lg"
         fit="cover"/>
    <img src="https://hypeapps.dev/gallery/assets/dish.jpg"
         style="w-full h-200 rounded-lg"
         fit="cover"/>
    <img src="https://hypeapps.dev/gallery/assets/city.jpg"
         style="w-full h-120 rounded-lg"
         fit="cover"/>
</masonry>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/masonry-light.webp), [dark](https://hypeapps.dev/img/tags/masonry-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `columns` | How many columns. | `2` |
| `run-spacing` (also `run_spacing`) | Gap between items in a column, px. |  |
| `spacing` | Gap between columns, px (and between items when run-spacing is not given). | `8` |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Related tags

- [`<img>`](https://hypeapps.dev/docs/reference/img.md): Shows a picture from a URL or the app's files, sized and cropped by its style.
- [`<address>`](https://hypeapps.dev/docs/reference/address.md): Contact details as a block, in italic by default, as HTML's address element.
- [`<aside>`](https://hypeapps.dev/docs/reference/aside.md): A side note set apart from the main text, as HTML's aside element; it works like a block.
- [`<background>`](https://hypeapps.dev/docs/reference/background.md): The layer a swiped dismissible row reveals behind it, such as a red delete strip.
- [`<block>`](https://hypeapps.dev/docs/reference/block.md): The general-purpose container: groups children and gives them padding, color, corners and a border.
- [`<card>`](https://hypeapps.dev/docs/reference/card.md): A surface for grouped content, with padding, rounded corners and a soft shadow.
- [`<center>`](https://hypeapps.dev/docs/reference/center.md): Centers its children and their lines of text, on both axes or only one.
- [`<col>`](https://hypeapps.dev/docs/reference/col.md): A box inside a row; its flex value sets its share of the row's width.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
