Flutter docs
Default skin

Masonry

A responsive masonry layout for items with varied heights.

When to use

Use Masonry for independent cards, images, or content blocks that intentionally form ragged columns.

Examples

Basic

Basic usage. Set number of columns with columns and spacing with gutter.

Responsive

Responsive layout adapts to different screen widths. Use columns to specify the number of columns at different breakpoints, and gutter to adjust spacing between items.

Image

Dynamically adjust the height of images as they load.

Dynamic

Demonstrate how masonry layout updates dynamically. Use item.column to keep items in place.

Custom semantic dom styling

You can customize the semantic dom style of Masonry by passing objects/functions through classNames and styles.

API

Masonry and MasonryProps are exported from @ceebee/ui/client.

Masonry

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
columnsNumber of columns, can be a fixed value or a responsive configurationnumber | { xs?: number; sm?: number; md?: number }3—
freshWhether to continuously monitor the size changes of child itemsbooleanfalse—
gutterSpacing, can be a fixed value, responsive configuration, or a configuration for horizontal and vertical spacingGap | \[Gap, Gap\]0—
itemsMasonry itemsMasonryItem[]-—
itemRenderCustom item rendering function(item: MasonryItem) => React.ReactNode-—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
onLayoutChangeCallback for column sorting changes({ key: React.Key; column: number }[]) => void-—

MasonryItem

PropertyDescriptionTypeDefaultVersion
childrenCustom display content, takes precedence over itemRenderReact.ReactNode-—
columnSpecifies the column to which the item belongsnumber-—
dataCustom data storageT-—
heightHeight of the itemnumber-—
keyUnique identifier for the itemstring | number-—