BlazorOverlay 1.0.0

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

BlazorOverlay

A blazor library to display overlays (dialog, loading indicators), without any js or css file.

Why

For large projects you have many existing good libraries for this purpose. For small projects you may expect something light-weight and portable. This is it. BlazorOverlay does not add javascript or css files to your project, and only requires simple setup (or none).

Installation

Option 1: Nuget

Search and install "BlazorOverlay" in Nuget Package Manager.

Option 2: Project Referrence

Download or Git-Clone this project, then referrence it in your Blazor project.

Usage

add service at startup:

public static void Main(string[] args)
{
    ...
    builder.Services.AddScoped<BlazorOverlay.Overlay>();
    ...
}

and then in a razor page:

@rendermode InteractiveServer
@inject BlazorOverlay.Overlay overlay

<div style="padding:20px;display:flex; flex-direction:column; gap:10px;">
        <div>
        <button @onclick="ShowLoader">Show Loader (click to close)</button>
    </div>
    <div>
        <button @onclick="ShowSuccess">Show Success (auto close)</button>
    </div>
    <div>
        <button @onclick="ShowMessage_HasCloseButton">Show Message (with close button)</button>
    </div>
    <div>
        <button @onclick="ShowMessage_NoCloseButton">Show Message (without close button)</button>
    </div>
    <div>
        <button @onclick="ShowMessage_AutoClose">Show Message (auto close)</button>
    </div>
</div>
@code {
    private async Task ShowMessage_HasCloseButton()
    {
        await overlay.ShowMessage(
            "A network issue is encountered, please try again.",
            hasCloseButton: true
        );
    }
    private async Task ShowMessage_NoCloseButton()
    {
        await overlay.ShowMessage(
            "A network issue is encountered, please refresh the page.",
            hasCloseButton: false
        );
    }
    private async Task ShowMessage_AutoClose()
    {
        var dialogRef = await overlay.ShowMessage(
            "A network issue is encountered.\n This message will disappeat in 4 seconds。", 
            hasCloseButton: true
        );
        await Task.Delay(4000);
        await overlay.Dismiss(dialogRef);
    }
    private async Task ShowLoader()
    {
        var dialogRef = await overlay.ShowLoader();
        await Task.Delay(1500);
        await overlay.ShowSuccess(dialogRef);
    }
    private async Task ShowSuccess()
    {
        await overlay.ShowSuccess(2000);
    }
}

Ad-hoc

Simply initialize an instance in page and just use it:

@inject IJSRuntime js
<button @onclick="ShowMessage_NoDI">Show Message (No DI)</button>
@code {
    private async Task ShowMessage_NoDI()
    {
        var overlay = new BlazorOverlay.Overlay(js);
        await overlay.ShowMessage("Show a message without using dependancy injection.");
    }
}

Source Code

This project is open sourced at GitHub.

Author

Fan Xing Hua (Miles)

License

Source code is licensed under MIT.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
1.0.0 341 9/16/2025