formaui-net.Framework.Feedback 1.0.0-preview.27

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

Forma.Framework.Feedback

The services behind Forma's feedback surfaces: a toast service any code raises a notice through, a confirm dialog service any code awaits a yes or no from, and a catalog of the statuses an application's badges are named after. Code calls the service, and the component that draws the surface, placed once in a layout, follows it.

Use it

The package comes with formaui-net.Blazor. AddFormaUIServices() registers its services through AddFormaFeedbackServices():

Service Registered as
IToastService ToastService, scoped.
IConfirmDialogService ConfirmDialogService, scoped.
IStatusBadgeCatalog An empty StatusBadgeCatalog, singleton.

Each is added with TryAdd, so a host registers its own first to replace one, which is how an application supplies its statuses:

using Forma.Framework.Css;
using Forma.Framework.Feedback;
using Forma.Framework.Icons;

builder.Services.AddSingleton<IStatusBadgeCatalog>(new StatusBadgeCatalog(
[
    new("open", CssColor.FromRgba(48, 127, 221, 0.14), CssColor.FromHex(0x1c5fa8)) { Marker = Glyph.Clock },
    new("resolved", CssColor.FromRgba(40, 167, 69, 0.14), CssColor.FromHex(0x1c7430)) { Marker = Glyph.CircleCheck },
    new("closed", CssColor.FromRgba(98, 105, 118, 0.12), CssColor.FromHex(0x2c384a)) { Marker = Glyph.Prohibited },
]));

builder.AddFormaServerIntegration();

Place FormaToastContainer and FormaConfirmDialog once in the layout; they draw what the services hold.

Toasts

IToastService.ShowAsync(message, type, duration, action, cancellationToken) adds a toast. type is a ToastType, Success, Error, Info or Warning, which decides its color and marker, and defaults to Success; duration defaults to three seconds. RemoveAsync(id, cancellationToken) removes one early, and Toasts lists those showing, each a ToastMessage with its Id, Message, Type, Action and Duration.

@using Forma.Blazor.Components.Buttons
@using Forma.Framework.Feedback
@inject IToastService Toasts

<FormaButton OnClick="SaveAsync">Save</FormaButton>

@code {
    private async Task SaveAsync()
    {
        try
        {
            await Orders.SaveAsync(_order);
            await Toasts.ShowAsync("Order saved.");
        }
        catch (OrderConflictException)
        {
            await Toasts.ShowAsync("Someone else changed this order. Reload it and try again.", ToastType.Error, TimeSpan.FromSeconds(8));
        }
    }
}

A toast's action

A toast can lead to what it announces through an action, a ToastAction with its label and either the Url it goes to or the Run callback it runs. FormaToastContainer draws it as a button beside the message, inside the toast's live region, so a screen reader hears its label with the message.

await Toasts.ShowAsync("Request sent.", ToastType.Info, action: new ToastAction("View Request")
{
    Url = new Uri($"requests/{request.Id}", UriKind.Relative),
});
  • The toast stays until it's dismissed or its action is used, since a reader needs time to reach the action, so a toast with an action takes no duration.
  • Using the action removes the toast before the action goes to its address or runs.
  • The keyboard reaches it where the container stands in the page's tab order, so place the container where a reader tabs to it, near the start of the layout rather than after a long page.
  • A dismissed or used toast hands the focus to the toast after it, or else the one before it.

ShowAsync throws ArgumentException for an action without a label, or one without exactly one of Url and Run, and for a duration given beside an action.

Confirmations

IConfirmDialogService.ConfirmAsync(message, confirmText, cancelText, cancellationToken) asks the question and completes with true when the reader picks the confirming button, false otherwise. All three strings are required, localized by the caller. A second request while one is pending answers the first false and takes its place. Current is the pending ConfirmDialogRequest, with its Message, ConfirmText, CancelText and the Result that completes it.

@using Forma.Blazor.Components.Buttons
@using Forma.Framework.Feedback
@inject IConfirmDialogService Confirm

<FormaButton OnClick="DeleteAsync">Delete</FormaButton>

@code {
    private async Task DeleteAsync()
    {
        if (await Confirm.ConfirmAsync("Delete this invoice? It cannot be recovered.", "Delete", "Keep"))
        {
            await Invoices.DeleteAsync(_invoice.Id);
        }
    }
}

Statuses

IStatusBadgeCatalog holds the statuses an application defines, each a StatusBadgeStyle with its Name, a Background and Foreground CssColorValue, and an optional Marker icon shown before the text so the status reads without color. A color is a literal CssColor, or a custom property a theme defines, CssColorValue.FromProperty("--success-subtle-color"), which follows the theme wherever it redefines the property. Add registers a status, replacing one of the same name, Find(name) returns one or null, and Statuses lists them all. StatusBadgeCatalog matches names regardless of case.

FormaStatusBadge adopts the colors and marker registered under its Status; its own Background, Foreground and Marker parameters take precedence over them.

@using Forma.Blazor.Components.Feedback

<FormaStatusBadge Status="@_ticket.Status" Text="@_ticket.StatusLabel" />

Drawing a surface of your own

IToastService and IConfirmDialogService are INotifyStateChanged from Forma.Framework.Events: Subscribe(Func<Task>) registers a callback run after every change to the toasts or the pending request, and Unsubscribe removes it. A host that draws either surface itself subscribes the same way the bundled components do.

License

Apache License 2.0, under the repository's LICENSE.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on formaui-net.Framework.Feedback:

Package Downloads
formaui-net.Blazor

A Blazor component library for .NET 11: form inputs and pickers, dialogs, popovers and toasts, toolbars and menus, tabs and layout, file pickers, uploaders and viewers, icons, emoji and windows.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.27 56 12/3/2026
1.0.0-preview.26 65 12/3/2026
1.0.0-preview.25 74 12/2/2026
1.0.0-preview.24 82 12/1/2026
1.0.0-preview.23 118 11/30/2026
1.0.0-preview.22 119 11/30/2026
1.0.0-preview.21 115 11/29/2026
1.0.0-preview.20 122 11/26/2026
1.0.0-preview.19 124 11/26/2026
1.0.0-preview.18 116 11/26/2026
1.0.0-preview.17 106 11/26/2026
1.0.0-preview.16 107 11/24/2026
1.0.0-preview.15 105 11/23/2026
1.0.0-preview.14 104 11/23/2026
1.0.0-preview.13 97 11/21/2026
1.0.0-preview.12 104 11/20/2026
1.0.0-preview.11 104 11/18/2026
1.0.0-preview.10 104 11/17/2026
1.0.0-preview.9 137 11/17/2026
1.0.0-preview.8 113 11/17/2026
Loading failed

What this release changed is in Forma's changelog: https://github.com/FormaUI/Forma/blob/v1.0.0-preview.27/CHANGELOG.md