Soenneker.Blazor.Masonry
4.0.2261
Prefix Reserved
dotnet add package Soenneker.Blazor.Masonry --version 4.0.2261
NuGet\Install-Package Soenneker.Blazor.Masonry -Version 4.0.2261
<PackageReference Include="Soenneker.Blazor.Masonry" Version="4.0.2261" />
<PackageVersion Include="Soenneker.Blazor.Masonry" Version="4.0.2261" />
<PackageReference Include="Soenneker.Blazor.Masonry" />
paket add Soenneker.Blazor.Masonry --version 4.0.2261
#r "nuget: Soenneker.Blazor.Masonry, 4.0.2261"
#:package Soenneker.Blazor.Masonry@4.0.2261
#addin nuget:?package=Soenneker.Blazor.Masonry&version=4.0.2261
#tool nuget:?package=Soenneker.Blazor.Masonry&version=4.0.2261
Soenneker.Blazor.Masonry ??
A lightweight, responsive Blazor component for Masonry (the cascading grid layout library) � perfect for image grids, cards, and dynamic content.
? Features
- Fully compatible with Bootstrap grid classes
- Script auto-loading (CDN or embedded)
- No manual cleanup required
Installation
dotnet add package Soenneker.Blazor.Masonry
Usage
- Register the interop within DI (
Program.cs)
public static async Task Main(string[] args)
{
...
builder.Services.AddMasonryInteropAsScoped();
}
?? Components
Masonry
Wraps a group of items in a Masonry layout.
<Masonry AutoRender="true" class="row"> // or if not Bootstrap, a different class
...
</Masonry>
Parameters:
AutoRender� Automatically initializes layout after renderSizerClass� Automatically adds a sizer with the given class(es). Used by Masonry to determine width of a single column.
MasonryItem
Wraps a single item in the layout and adds the required class.
<MasonryItem class="col-md-6">
<div class="card">...</div>
</MasonryItem>
Automatically appends masonry-item to the class attribute.
?? Example
<Masonry AutoRender="false" SizerClass="col-sm-1" @ref="_masonry" class="row">
@foreach (var card in _cards)
{
<MasonryItem class="col-lg-4 col-md-6 mb-4">
<div class="card">
<img src="@card.ImageUrl" class="card-img-top" />
<div class="card-body">
<h5>@card.Title</h5>
<p>@card.Text</p>
</div>
</div>
</MasonryItem>
}
</Masonry>
@code {
private Masonry _masonry = null!;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// Example delay for images to load
await Task.Delay(3000);
await _masonry.Init();
}
}
}
?? Initialization
- If
AutoRenderistrue, Masonry initializes on first render. - If
false, callInit()manually when ready (e.g., after images load). - No disposal needed � cleanup is handled automatically when navigating away.
?? Manual Interop Usage
If you want full control without using the Masonry component, you can use the provided IMasonryInterop service directly.
@inject IMasonryInterop MasonryInterop
Warmup (Script Load)
await MasonryInterop.Warmup(); // Loads Masonry script from CDN
Or use the embedded version:
await MasonryInterop.Warmup(useCdn: false);
Initialize Layout
await MasonryInterop.Init("myElementId");
Advanced options:
await MasonryInterop.Init(
elementId: "gallery",
containerSelector: "#gallery",
itemSelector: ".masonry-item",
columnWidthSelector: ".masonry-sizer",
percentPosition: true,
transitionDurationSecs: 0.25f,
useCdn: true
);
Force Layout Recalculation
await MasonryInterop.Layout("gallery");
Set Up Mutation Observer
await MasonryInterop.CreateObserver("gallery");
Destroy Instance
await MasonryInterop.Destroy("gallery");
?? Note: The
Masonrycomponent handles these automatically. Use manual interop when building custom wrappers or integrations.
| 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.45)
- Soenneker.Blazor.Utils.ResourceLoader (>= 4.0.1650)
- Soenneker.Extensions.String (>= 4.0.666)
- Soenneker.Quark.Components.Core.Cancellable (>= 4.0.66)
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.2261 | 41 | 4/15/2026 |
| 4.0.2260 | 74 | 4/15/2026 |
| 4.0.2259 | 70 | 4/15/2026 |
| 4.0.2257 | 78 | 4/14/2026 |
| 4.0.2256 | 77 | 4/14/2026 |
| 4.0.2255 | 82 | 4/13/2026 |
| 4.0.2254 | 81 | 4/13/2026 |
| 4.0.2251 | 78 | 4/13/2026 |
| 4.0.2250 | 86 | 4/10/2026 |
| 4.0.2249 | 107 | 4/8/2026 |
| 4.0.2247 | 91 | 4/8/2026 |
| 4.0.2246 | 82 | 4/8/2026 |
| 4.0.2245 | 81 | 4/8/2026 |
| 4.0.2244 | 86 | 4/7/2026 |
| 4.0.2241 | 95 | 4/5/2026 |
| 4.0.2240 | 88 | 4/1/2026 |
| 4.0.2239 | 91 | 3/31/2026 |
| 4.0.2238 | 86 | 3/31/2026 |
| 4.0.2237 | 173 | 3/26/2026 |
| 4.0.2236 | 91 | 3/26/2026 |
Update dependency Soenneker.Blazor.Utils.ResourceLoader to 4.0.1650 (#2898)