Soenneker.Blazor.Masonry 4.0.2234

Prefix Reserved
dotnet add package Soenneker.Blazor.Masonry --version 4.0.2234
                    
NuGet\Install-Package Soenneker.Blazor.Masonry -Version 4.0.2234
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Blazor.Masonry" Version="4.0.2234" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Masonry" Version="4.0.2234" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Blazor.Masonry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Blazor.Masonry --version 4.0.2234
                    
#r "nuget: Soenneker.Blazor.Masonry, 4.0.2234"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Blazor.Masonry@4.0.2234
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Blazor.Masonry&version=4.0.2234
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Masonry&version=4.0.2234
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image 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

  1. 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 render
  • SizerClass � 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 AutoRender is true, Masonry initializes on first render.
  • If false, call Init() 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 Masonry component handles these automatically. Use manual interop when building custom wrappers or integrations.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2234 27 3/23/2026
4.0.2233 24 3/22/2026
4.0.2232 28 3/22/2026
4.0.2231 33 3/22/2026
4.0.2230 34 3/20/2026
4.0.2229 30 3/19/2026
4.0.2228 37 3/19/2026
4.0.2227 114 3/15/2026
4.0.2226 88 3/14/2026
4.0.2225 83 3/14/2026
4.0.2224 88 3/13/2026
4.0.2223 85 3/13/2026
4.0.2222 82 3/13/2026
4.0.2220 83 3/12/2026
4.0.2218 80 3/12/2026
4.0.2217 81 3/12/2026
4.0.2216 91 3/12/2026
4.0.2215 82 3/11/2026
4.0.2214 88 3/11/2026
4.0.2213 86 3/11/2026
Loading failed

Update dependency Soenneker.Blazor.Utils.ResourceLoader to 4.0.1633 (#2861)