Soenneker.Blazor.Masonry 11.0.2563

Prefix Reserved
dotnet add package Soenneker.Blazor.Masonry --version 11.0.2563
                    
NuGet\Install-Package Soenneker.Blazor.Masonry -Version 11.0.2563
                    
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="11.0.2563" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Masonry" Version="11.0.2563" />
                    
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 11.0.2563
                    
#r "nuget: Soenneker.Blazor.Masonry, 11.0.2563"
                    
#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@11.0.2563
                    
#: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=11.0.2563
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Masonry&version=11.0.2563
                    
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

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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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
11.0.2563 44 11/12/2026
11.0.2562 46 11/12/2026
11.0.2561 46 11/12/2026
11.0.2560 46 11/12/2026
11.0.2559 45 11/11/2026
11.0.2558 45 11/11/2026
11.0.2557 51 11/11/2026
11.0.2555 46 11/11/2026
11.0.2554 43 11/11/2026
11.0.2553 57 11/11/2026
11.0.2551 53 11/11/2026
11.0.2550 54 11/11/2026
11.0.2549 60 11/11/2026
11.0.2543 74 11/11/2026
11.0.2542 77 11/11/2026
11.0.2541 103 11/4/2026
11.0.2540 82 11/3/2026
11.0.2539 90 11/3/2026
11.0.2538 88 11/3/2026
11.0.2536 89 11/3/2026
Loading failed

Updated Soenneker.Blazor.Utils.ResourceLoader to 11.0.1836