Skip to content
Reference Platforms

Platforms

What runs where, what you must set up, and the limits that are known today. Everything below comes from the project files and the code. Where something was run, the page says so; where it was only declared, it says that too.

On this page

At a glance

Target Klyroo.Form.Core Klyroo.Form
Console, worker, minimal API, test project Yes Not applicable
NativeAOT Compatible, published and run Not declared
Trimming Marked trimmable Marked trimmable
Blazor Interactive Server Not applicable Yes
Blazor Interactive WebAssembly Not applicable Yes
Blazor Interactive Auto Not applicable Yes
Blazor Static SSR Not applicable Renders, not interactive
.NET MAUI Blazor Hybrid Not applicable Supported platforms declared, not run on a device
.NET MAUI without a BlazorWebView Yes, from view models Not applicable (use Klyroo.Form.Maui for native views)

Klyroo.Form.DataAnnotations references only Klyroo.Form.Core, so it runs wherever the core runs. It is marked trimmable and is not declared NativeAOT compatible.

Both packages target net11.0. Klyroo.Form.Core has no package or project dependencies. Klyroo.Form depends on Klyroo.UI and on Klyroo.Form.Core.

Render modes

KlyFormEngine<TModel>, KlyFormPage<TModel>, KlyFormFieldView<TModel>, KlyFieldTemplate, KlyDynamicFormEngine, KlyDynamicFormPage, KlyDynamicFieldView and KlyFormProvider are built from standard Blazor events (@oninput, @onchange, @onclick, @onkeydown, @onsubmit) and make no JavaScript interop calls except one best-effort focus helper (klyroo-form.js, loaded on demand; the form works without it). KlyFormProvider hosts its overlay in KlyModal and KlySlideover of Klyroo.UI, so it needs the Klyroo.UI script like those components do. They need an interactive render mode to respond to input.

Interactive Server. Works. Add @rendermode InteractiveServer to the page, or set the render mode globally. FormService and DynamicFormService are registered as scoped services, so they live as long as the circuit, and a KlyFormProvider in the layout serves the whole circuit.

Interactive WebAssembly and Auto. Work. Components run in the browser, and in Auto also on the server for the first render, so call AddKlyrooForm() in both the server project and the .Client project. A scoped service in WebAssembly lives as long as the app.

Static SSR. The components render their markup, but without a circuit or WebAssembly nothing handles the events, so typing, validation, steps and submit do nothing. There is no form-post fallback: the engine does not set a form name or post to the server. Render the form interactively.

Prerendering. Interactive pages are prerendered by default. The prerender produces the initial markup; when the page becomes interactive, the component starts again and KlyFormEngine<TModel> creates its own controller from Schema and Model (KlyDynamicFormEngine does the same from Schema and Input). Values typed before that moment are not carried over, and neither is state in a controller you created yourself unless you persist it with your own means, for example with a draft (ExportDraft() and RestoreDraft()).

Controller lifetime. A controller passed through Form belongs to you: create it once, for example in a field of the page, and the component subscribes to it and unsubscribes on dispose. Dispose it yourself when the page goes away, which cancels the asynchronous rules still pending. A schema passed through Schema belongs to the component, which creates a new controller whenever the instance changes, and disposes it.

Stylesheets

The theme tokens (--klyroo-*) come from Klyroo.UI, and the form's own classes come from klyroo-form.css, which the package ships as a static web asset:

Razor
<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.preflight.css"]" />
<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.css"]" />
<link rel="stylesheet" href="@Assets["_content/Klyroo.Form/klyroo-form.css"]" />

The form relies on Klyroo.UI tokens for color, border and radius, so with only klyroo-form.css the colors resolve to nothing. The Klyroo.UI repository describes its other styling modes, including Tailwind compiled by your app; this package ships its classes as the precompiled klyroo-form.css and this documentation does not cover mixing it with your own Tailwind build.

.NET MAUI Blazor Hybrid

Klyroo.Form declares browser, ios, android, maccatalyst and windows as SupportedPlatform items, so a multi-targeted MAUI project that references it does not get platform compatibility warnings for it. The repository tests render the components with bUnit; no test runs on a device or emulator, so treat the platform list as a declaration.

Register the services in MauiProgram.cs, after AddMauiBlazorWebView():

C#
using Klyroo.Form;

builder.Services.AddMauiBlazorWebView();
builder.Services.AddKlyrooForm();

Load the same three stylesheets from wwwroot/index.html, with plain paths instead of @Assets:

HTML
<link rel="stylesheet" href="_content/Klyroo.UI/klyroo.preflight.css" />
<link rel="stylesheet" href="_content/Klyroo.UI/klyroo.css" />
<link rel="stylesheet" href="_content/Klyroo.Form/klyroo-form.css" />

Klyroo.UI itself declares browser as its SupportedPlatform in its project file (it runs inside a BlazorWebView on MAUI, while native MAUI apps use Klyroo.UI.Maui and Klyroo.Form.Maui).

.NET MAUI with XAML or C# views

If your pages do not use a BlazorWebView, reference Klyroo.Form.Core to bind your own view models to FormController<TModel> and subscribe to Changed (marshal to the UI thread if you update the controller off it).

The repository also includes Klyroo.Form.Maui (src/Klyroo.Form.Maui): native .NET MAUI views (KlyFormEngine<TModel>, KlyFormPage<TModel>, KlyFormFieldView<TModel>, KlyFormProvider, KlyFormErrorSummary, KlyFormNavigationGuard and the runtime-schema KlyDynamic* views) over Klyroo.Form.Core, built on Klyroo.UI.Maui inputs with no WebView. It requires the MAUI workload and a sibling checkout of klyroo-ui, and is built and unit-tested by .github/workflows/maui.yml.

NativeAOT and trimming

Klyroo.Form.Core sets IsAotCompatible and IsTrimmable to true, and the solution builds with warnings as errors, so the AOT and trimming analyzers are part of every build. An earlier version was also checked end to end: a console app that references the project and sets PublishAot published and ran on linux-x64; the engine has not changed in how it converts values, but the typed schema added since was checked with the analyzers only, not published and run. The engine itself uses no reflection over your types and no serialization: control values are object? and conversions compare types and go through Convert.ChangeType. The typed schema (FormSchema.For) reads expressions only to find the member, never compiles them, and reads and writes a direct member through delegates created from its accessors. TModel and the type argument of Group and List carry DynamicallyAccessedMembers(PublicProperties | PublicParameterlessConstructor), so the trimmer keeps what the schema touches and the analyzers raise no warning. A member chain such as m => m.Address.City, a member declared on an interface and a collection member are read and written through PropertyInfo: the trimmer keeps the accessors of Address but not necessarily the setter of City, which is why Group is the form to use in an app that is trimmed in full mode.

Klyroo.Form.DataAnnotations sets IsTrimmable and is not declared AOT compatible. It never calls Validator, whose methods require unreferenced code, and builds its ValidationContext with a display name for the same reason, so the trim analyzer reports nothing. Attributes are read from the properties of the model, which the annotation on TModel keeps, and a [Display] with a ResourceType needs that resource type to be kept by your app.

Klyroo.Form sets IsTrimmable to true but does not set IsAotCompatible. Whether a Blazor app that uses it can be trimmed or compiled ahead of time also depends on Klyroo.UI and on the Blazor runtime, and that combination was not tested here.

Known limitations

  • The built-in texts and messages come in twelve languages, but only English and French are reviewed by a native speaker. See the FAQ.