FormKit.Abstractions
1.7.0
dotnet add package FormKit.Abstractions --version 1.7.0
NuGet\Install-Package FormKit.Abstractions -Version 1.7.0
<PackageReference Include="FormKit.Abstractions" Version="1.7.0" />
<PackageVersion Include="FormKit.Abstractions" Version="1.7.0" />
<PackageReference Include="FormKit.Abstractions" />
paket add FormKit.Abstractions --version 1.7.0
#r "nuget: FormKit.Abstractions, 1.7.0"
#:package FormKit.Abstractions@1.7.0
#addin nuget:?package=FormKit.Abstractions&version=1.7.0
#tool nuget:?package=FormKit.Abstractions&version=1.7.0
FormKit
A lightweight, fluent form builder for Blazor that generates accessible EditForm markup, validation wiring, and field components from a strongly-typed model. Renderer-agnostic: the same fluent definition works with plain HTML, MudBlazor, or FluentUI via swappable renderers.
Quickstart
1. Install
dotnet add package FormKit
dotnet add package FormKit.Renderers.Html
2. Register services
builder.Services.AddFormKit()
.UseHtmlRenderer();
3. Define and render a form
@page "/customers/new"
@using FormKit
<FormKitForm TModel="CustomerVm"
Definition="@_form"
Model="@_model"
OnValidSubmit="HandleSubmit" />
@code {
private CustomerVm _model = new();
private readonly FormDefinition<CustomerVm> _form = FormBuilder.For<CustomerVm>()
.Field(x => x.Name).Required().MaxLength(120)
.Field(x => x.Email).Required()
.Field(x => x.IsCompany).Label("Is a company")
.Field(x => x.CompanyName)
.When(m => m.IsCompany)
.Required()
.Group("Address", g => g
.Field(x => x.Address.Street).Required()
.Field(x => x.Address.City).Required()
.Field(x => x.Address.Country).Select<Country>())
.Build();
private Task HandleSubmit(EditContext context) => _service.CreateAsync(_model);
}
Features
- Fluent API — describe forms from POCO models in a few lines
- Accessible by default — correct
label/forassociation,aria-required,aria-invalid,aria-describedby,role="alert"error regions - Conditional fields —
.When(m => m.IsCompany)shows/hides fields based on model state - Multi-step forms —
.Step("Customer", ...)with per-step validation - Field groups —
.Group("Address", ...)renders as<fieldset>with<legend> - DataAnnotations validation — built-in via
EditFormandDataAnnotationsValidator - Pluggable renderers — swap UI libraries without rewriting form definitions
- Trimming & AOT friendly — annotated with
IsTrimmable=true
Supported Field Types
| Type | Auto-detected from | HTML input |
|---|---|---|
| Text | string |
<input type="text"> |
| Number | int, long, short, byte |
<input type="number"> |
| Decimal | decimal, double, float |
<input type="number" step="any"> |
| Checkbox | bool |
<input type="checkbox"> |
| Date | DateOnly |
<input type="date"> |
| DateTime | DateTime, DateTimeOffset |
<input type="datetime-local"> |
| Time | TimeOnly, TimeSpan |
<input type="time"> |
| Select | via .Select<T>() / .Options(...) |
<select> |
| RadioGroup | via .RadioGroup<T>() / .RadioGroup(...) |
radio inputs |
| MultiSelect | via .MultiSelect<T>() / .MultiSelect(...) |
<select multiple> |
| FileUpload | via .File(accept?) |
<InputFile> (binds IBrowserFile) |
| Collection | via .Collection(x => x.List, item => …) |
repeating <fieldset> per item + add/remove |
| MultilineText | via .Type(FieldType.MultilineText) |
<textarea> |
| Hidden | via .Type(FieldType.Hidden) |
<input type="hidden"> |
Architecture
| Package | Purpose |
|---|---|
FormKit.Abstractions |
Interfaces (IFormRenderer, IFieldDescriptor, IValidationAdapter) |
FormKit |
Fluent builder, validation orchestration, FormKitForm component |
FormKit.Renderers.Html |
Plain HTML renderer (zero-dependency, accessible) |
FormKit.Renderers.FluentUI |
Microsoft Fluent UI Blazor renderer (.UseFluentUIRenderer()) |
FormKit.FluentValidation |
FluentValidation adapter (FormKitForm.Validator) |
A live demo (Blazor WebAssembly, with an HTML/FluentUI renderer toggle) is published to GitHub Pages: https://agriffard.github.io/FormKit/.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.AspNetCore.Components (>= 10.0.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FormKit.Abstractions:
| Package | Downloads |
|---|---|
|
FormKit
Fluent form builder for Blazor — define forms from POCO models with pluggable renderers and validation. |
GitHub repositories
This package is not used by any popular GitHub repositories.