Snork.Blazor.BlockUI 1.0.0

dotnet add package Snork.Blazor.BlockUI --version 1.0.0                
NuGet\Install-Package Snork.Blazor.BlockUI -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="Snork.Blazor.BlockUI" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Snork.Blazor.BlockUI --version 1.0.0                
#r "nuget: Snork.Blazor.BlockUI, 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.
// Install Snork.Blazor.BlockUI as a Cake Addin
#addin nuget:?package=Snork.Blazor.BlockUI&version=1.0.0

// Install Snork.Blazor.BlockUI as a Cake Tool
#tool nuget:?package=Snork.Blazor.BlockUI&version=1.0.0                

Snork.Blazor.BlockUI

The BlockUI component lets you simulate synchronous behavior when using Blazor, without locking the browser. When activated, it will prevent user activity with the page until it is deactivated. BlockUI adds elements to the DOM to give it both the appearance and behavior of blocking user interaction.

Usage is very simple. First, place an instance in your Razor page, with a reference variable:

<BlockUI @ref="_myBlockUI"/>

@code {
    BlockUI? _myBlockUI;
}

Blocking The Page

To block user activity for the page, execute this code:

await _myBlockUI.Block();

To block with a custom message, there are two approaches. You can put the custom message into markup directly, like this:

<BlockUI @ref="_myBlockUI">
    <Template>
        This is the custom message.
    </Template
</BlockUI>

The second way to use a custom message is:

await _myBlockUI.Block(@<text>This is the custom message.</text>);

You can use custom styling with the component, as follows:

await _myBlockUI.WithCss(i =>
    {
        i.BackgroundColor = "#f00";
        i.Color = "#fff";
    }).WithOverlay(i =>
    {
        i.BackgroundColor = "blue";
    }).Block();

Unblocking the Page

To unblock the page:

await _myBlockUI.Unblock();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
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 293 12/18/2022

Initial release