Layout

Masonry

Pure CSS waterfall layout that packs variable-height children into balanced columns.

import { Masonry } from '@lostgradient/cinder/masonry';
layoutmasonry
01

Overview

Masonry renders a pure CSS waterfall layout with balanced variable-height columns. It uses CSS columns, so DOM and screen-reader order remain top-to-bottom through each column rather than left-to-right across visual rows.

Usage

svelte
<script lang="ts">
  import { Masonry } from '@lostgradient/cinder/masonry';
</script>

<Masonry columns="3" gap="var(--cinder-space-4)">
  <article>Short card</article>
  <article>Much taller card content</article>
  <article>Medium card</article>
</Masonry>
Live preview
02

When to use

Use when
  • Displaying cards, images, or panels with uneven heights where CSS column order is acceptable.
Avoid when
03

Examples

Variable-height cards

CSS columns pack uneven cards into a masonry-style waterfall while keeping DOM order intact.

04

Props

Props for masonry
NameTypeDefaultDescription
columns text CSS column count value.
gap text Gap between columns and between direct children.
as 'article''aside''div''footer''header''main''nav''section'
2 more members 'ul''ol'
'div' Rendered HTML tag. Constrained to layout-safe container elements; void elements such as img, input, br, and hr are excluded.
children required snippet Masonry contents.