1. Reference
  2. Layout

<masonry>

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

Layout
masonry.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>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
columns How many columns.
number
2
run-spacing
also run_spacing
Gap between items in a column, px.
number
spacing Gap between columns, px (and between items when run-spacing is not given).
number
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.

This page is also Markdown, and all of HAM is in llms.txt.