Sotsera.Blazor.Toaster 0.6.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Sotsera.Blazor.Toaster --version 0.6.1
NuGet\Install-Package Sotsera.Blazor.Toaster -Version 0.6.1
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="Sotsera.Blazor.Toaster" Version="0.6.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sotsera.Blazor.Toaster --version 0.6.1
#r "nuget: Sotsera.Blazor.Toaster, 0.6.1"
#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 Sotsera.Blazor.Toaster as a Cake Addin
#addin nuget:?package=Sotsera.Blazor.Toaster&version=0.6.1

// Install Sotsera.Blazor.Toaster as a Cake Tool
#tool nuget:?package=Sotsera.Blazor.Toaster&version=0.6.1

Sotsera.Blazor.Toaster

A Blazor port of Toastr.js in pure .Net. If there is any credit here it should go to the authors of the original library.

The sample project has been published here.

The transitions are implemented using System.Threading.Timer instances (at least for now) and no javascript is involved.

Changes

  • version 0.6.1

    • IToaster registered as scoped service
  • version 0.6.0

    • upgraded to blazor 0.6.0
  • version 0.6.0-preview1

    • upgraded to blazor 0.6.0-preview1-final
    • css cursor forced to pointer on toast's outer div in order to allow them to be tappable on safari (ios)
  • version 0.5.3

    • removed global.json files
    • the new RequireInteraction option disables the toast auto fade out
  • version 0.5.2

    • upgraded to blazor 0.5.1
  • version 0.5.1

    • upgraded to blazor 0.5.0
  • version 0.4.0

    • MaxDisplayedToasts is now an integer ranging from 0 to 100
    • The VisibleStepDuration option has been renamed to ProgressBarStepDuration

Configuration

Install-Package Sotsera.Blazor.Toaster

Configure the dependency injection

services.AddToaster(config =>
{
    config.PositionClass = Defaults.Classes.Position.TopRight;
    config.PreventDuplicates = true;
    config.NewestOnTop = false;
});

and add the toast container to App.cshtml (or to another component always loaded in the application)

@addTagHelper *, Sotsera.Blazor.Toaster
<toastContainer />

Usage

In a component

@inject Sotsera.Blazor.Toaster.IToaster toaster;

In a class

[inject]
Sotsera.Blazor.Toaster.IToaster toaster;

then call one of the display methods:

toaster.Info("toast body text");
toaster.Success("toast body text");
toaster.Warning("toast body text");
toaster.Error("toast body text");

Each of these methods can accept a title and an action for the toast specific configuration

toaster.Info("toast body text");
toaster.Info("toast body text", "toast title");
toaster.Info("toast body text", "toast title", options =>
{
    options.Clicked += toast => Console.WriteLine($"Toast '{toast.Message}' Clicked!");
});

Credits

This is a simple attempt to port Toastr.js to Blazor.

Currently the css styles used are literally COPIED from Toastr.js.

License

Sotsera.Blazor.Toaster is licensed under MIT license

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Sotsera.Blazor.Toaster:

Package Downloads
BlazingComponents.Lib

Components, Controller, Service and State Provider for Asp.NetCore Blazor.

MyJetWallet.Sdk.AdminPanel

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Sotsera.Blazor.Toaster:

Repository Stars
ArduPilot/MissionPlanner
Mission Planner Ground Control Station for ArduPilot (c# .net)
blogifierdotnet/Blogifier
Blogifier is an open-source publishing platform Written in ASP.NET and Blazor WebAssembly. With Blogifier make a personal blog or a website.
Version Downloads Last updated
3.0.0 172,019 1/3/2020
2.0.0 1,744 12/5/2019
2.0.0-beta1 538 11/30/2019
1.0.0 5,666 9/28/2019
1.0.0-preview9.1 1,236 9/4/2019
1.0.0-preview.8.1 482 8/14/2019
0.11.1 551 7/30/2019
0.10.1 390 7/13/2019
0.10.0 2,578 6/16/2019
0.9.0-preview-3 824 4/25/2019
0.9.0-preview-1 763 3/12/2019
0.8.0-preview-4 621 2/14/2019
0.6.1 1,319 2/12/2019
0.6.0 3,163 10/4/2018
0.5.3 982 8/25/2018
0.5.2 852 7/30/2018
0.5.1 762 7/26/2018
0.4.1 778 7/23/2018
0.4.0 954 7/18/2018