Soenneker.Blazor.Masonry
4.0.2424
Prefix Reserved
dotnet add package Soenneker.Blazor.Masonry --version 4.0.2424
NuGet\Install-Package Soenneker.Blazor.Masonry -Version 4.0.2424
<PackageReference Include="Soenneker.Blazor.Masonry" Version="4.0.2424" />
<PackageVersion Include="Soenneker.Blazor.Masonry" Version="4.0.2424" />
<PackageReference Include="Soenneker.Blazor.Masonry" />
paket add Soenneker.Blazor.Masonry --version 4.0.2424
#r "nuget: Soenneker.Blazor.Masonry, 4.0.2424"
#:package Soenneker.Blazor.Masonry@4.0.2424
#addin nuget:?package=Soenneker.Blazor.Masonry&version=4.0.2424
#tool nuget:?package=Soenneker.Blazor.Masonry&version=4.0.2424
Soenneker.Blazor.Masonry
Blazor components and interop for arranging variable-height items with Masonry.
Installation
dotnet add package Soenneker.Blazor.Masonry
using Soenneker.Blazor.Masonry.Registrars;
builder.Services.AddMasonryInteropAsScoped();
Add the component namespace to _Imports.razor:
@using Soenneker.Blazor.Masonry
Automatic layout
<Masonry class="row" SizerClass="col-sm-6 col-lg-4">
@foreach (Card card in cards)
{
<MasonryItem class="col-sm-6 col-lg-4 mb-3">
<article class="card">
<h2>@card.Title</h2>
<p>@card.Description</p>
</article>
</MasonryItem>
}
</Masonry>
MasonryItem always appends the masonry-item class. When SizerClass is supplied, the container renders an empty .masonry-sizer element with those width classes and uses it as the column width. The library does not include Bootstrap; the example classes work only when the application supplies Bootstrap or equivalent CSS.
Automatic initialization runs after the first render. It works best when item dimensions are already stable.
Images and changing content
Images can change item height after Masonry's first measurement. Initialize only after the images are ready, or call Layout() from the image load path:
<Masonry @ref="_masonry"
AutoRender="false"
SizerClass="gallery-column">
@foreach (Photo photo in photos)
{
<MasonryItem class="gallery-column">
<img src="@photo.Url" alt="@photo.Alt" @onload="ImageLoaded" />
</MasonryItem>
}
</Masonry>
@code {
private Masonry? _masonry;
private int _loadedImages;
private bool _initialized;
private async Task ImageLoaded()
{
_loadedImages++;
if (_loadedImages == photos.Count)
{
await _masonry!.Init();
_initialized = true;
}
else if (_initialized)
await _masonry!.Layout();
}
}
When adding or removing rendered items after initialization, call Layout() after Blazor has rendered the new DOM. The built-in observer watches removal of the entire Masonry container for cleanup; it does not automatically re-layout child mutations or image loads.
Asset source
The component loads a pinned Masonry script from jsDelivr with an integrity check. For direct interop usage, Warmup(useCdn: false) or Init(..., useCdn: false) selects the packaged script instead. The scoped loader initializes once, so use the same source choice throughout a scope.
Most applications should use the components. IMasonryInterop is available to custom wrapper authors and supports Init, Layout, CreateObserver, and Destroy by element ID. Invalid selectors and calls to Layout before initialization surface as JavaScript interop errors rather than being silently ignored.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.Asyncs.Initializers (>= 4.0.92)
- Soenneker.Blazor.Utils.ResourceLoader (>= 4.0.1738)
- Soenneker.Lepton.Suite (>= 4.0.75)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.2424 | 0 | 9/9/2026 |
| 4.0.2423 | 0 | 9/9/2026 |
| 4.0.2422 | 4 | 9/8/2026 |
| 4.0.2421 | 56 | 9/8/2026 |
| 4.0.2420 | 51 | 9/8/2026 |
| 4.0.2419 | 46 | 9/8/2026 |
| 4.0.2418 | 46 | 9/8/2026 |
| 4.0.2416 | 61 | 9/7/2026 |
| 4.0.2415 | 56 | 9/7/2026 |
| 4.0.2414 | 53 | 9/7/2026 |
| 4.0.2413 | 59 | 9/7/2026 |
| 4.0.2412 | 59 | 9/7/2026 |
| 4.0.2411 | 59 | 9/5/2026 |
| 4.0.2410 | 62 | 9/5/2026 |
| 4.0.2409 | 64 | 9/4/2026 |
| 4.0.2408 | 60 | 9/4/2026 |
| 4.0.2407 | 60 | 9/4/2026 |
| 4.0.2406 | 61 | 9/4/2026 |
| 4.0.2405 | 59 | 9/4/2026 |
| 4.0.2404 | 64 | 9/4/2026 |
Updated Multiple NuGet packages