Persilsoft.Toast.Blazor 1.0.5

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

// Install Persilsoft.Toast.Blazor as a Cake Tool
#tool nuget:?package=Persilsoft.Toast.Blazor&version=1.0.5

Persilsoft.Toast.Blazor

A Toast library for Blazor and Razor Components applications.


Example First, you need to register the following group of services in the dependency container.

using ServiceCollectionExtensions;

builder.Services.AddToastService();

Then you need to add an Toast component in your razor view, for example in the MainLayout component.

@using Persilsoft.Toast.Blazor

<div class="page">
    <div class="sidebar">
        <NavMenu />
    </div>
    <main>
        <article class="content px-4">
            @Body
        </article>
    </main>
</div>
<Toast />

The Toast component optionally accepts the parameter Position. This enumeration can take one of the following values:
ToastPosition.TopLeft
ToastPosition.TopCenter
ToastPosition.TopRight (default value)
ToastPosition.MiddleLeft
ToastPosition.MiddleCenter
ToastPosition.MiddleRight
ToastPosition.BottomLeft
ToastPosition.BottomCenter
ToastPosition.BottomRight

<Toast Position="ToastPosition.BottomLeft" />

Finally you can use it.

@page "/toastdemo"
@using Persilsoft.Toast.Blazor
@inject IToastService ToastService;

<PageTitle>Toast Demo</PageTitle>

<h1>Toast Demo</h1>
<hr />
<button class="btn btn-info" @onclick=ShowToastInfo>Show toast info</button>
<button class="btn btn-success" @onclick=ShowToastSuccess>Show toast success</button>
<button class="btn btn-warning" @onclick=ShowToastWarning>Show toast warning</button>
<button class="btn btn-danger" @onclick=ShowToastError>Show toast danger</button>

@code {
    private async Task ShowToastInfo()
    {
        await ToastService.ShowInfo("Info!", "This is the show toast info");
    }

    private async Task ShowToastSuccess()
    {
        await ToastService.ShowSuccess("Success!", "This is the show toast success", 3);
    }

    private async Task ShowToastWarning()
    {
        await ToastService.ShowWarning("Warning!", "This is the show toast warning");
    }

    private async Task ShowToastError()
    {
        await ToastService.ShowError("Danger!", "This is the show toast error", 0);
    }
}
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. 
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.5 73 4/24/2024
1.0.4 78 4/18/2024
1.0.3 75 4/18/2024
1.0.2 75 4/18/2024
1.0.1 85 4/16/2024
1.0.0 85 4/16/2024