Movatterモバイル変換


[0]ホーム

URL:


Skip to content
🚀 Influence MUI's 2026 roadmap! Take our latest Developer Survey
+

Masonry

Masonry lays out contents of varying dimensions as blocks of the same width and different height with configurable gaps.

Masonry maintains a list of content blocks with a consistent width but different height.The contents are ordered by row.If a row is already filled with the specified number of columns, the next item starts another row, and it is added to the shortest column in order to optimize the use of space.

Basic masonry

A simple example of aMasonry.Masonry is a container for one or more items. It can receive any element including<div /> and<img />.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PressEnter to start editing

Image masonry

This example demonstrates the use ofMasonry for images.Masonry orders its children by row.If you'd like to order images by column, check outImageList.

1
Fern
2
Snacks
3
Mushrooms
4
Tower
5
Sea star
6
Honey
7
Basketball
8
Breakfast
9
Tree
10
Burger
11
Camera
12
Coffee
13
Camping Car
14
Hats
15
Tomato basil
16
Mountain
17
Bike

Items with variable height

This example demonstrates the use ofMasonry for items with variable height.Items can move to other columns in order to abide by the rule that items are always added to the shortest column and hence optimize the use of space.

Contents

Contents

Contents

Contents

Contents

Contents

Contents

Contents

Contents

Contents
PressEnter to start editing

Columns

This example demonstrates the use of thecolumns to configure the number of columns of aMasonry.

1
2
3
4
5
6
7
8
9
10
PressEnter to start editing

columns accepts responsive values:

1
2
3
4
5
6
7
8
9
10
PressEnter to start editing

Spacing

This example demonstrates the use of thespacing to configure the spacing between items.It is important to note that the value provided to thespacing prop is multiplied by the theme's spacing field.

1
2
3
4
5
6
7
8
9
10
PressEnter to start editing

spacing accepts responsive values:

1
2
3
4
5
6
7
8
9
10
PressEnter to start editing

Sequential

This example demonstrates the use of thesequential to configure the sequential order.Withsequential enabled, items are added in order from left to right rather than adding to the shortest column.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PressEnter to start editing

Server-side rendering

This example demonstrates the use of thedefaultHeight,defaultColumns anddefaultSpacing, which are used tosupport server-side rendering.

defaultHeight should be large enough to render all rows. Also, it is worth mentioning that items are not added to the shortest column in case of server-side rendering.

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.


[8]ページ先頭

©2009-2026 Movatter.jp