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
                    
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.2424" />
                    
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.2424" />
                    
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.2424
                    
#r "nuget: Soenneker.Blazor.Masonry, 4.0.2424"
                    
#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.2424
                    
#: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.2424
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Masonry&version=4.0.2424
                    
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 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.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
Loading failed

Updated Multiple NuGet packages