Platforms
What runs where. The facts below come from the project files and from running the samples; anything not listed here is not verified.
On this page
Klyroo. |
Klyroo. |
|
|---|---|---|
| Target framework | net11.0 |
net11.0 |
IsTrimmable |
true | true |
IsAotCompatible |
true | not declared |
| Supported platforms | not restricted | browser, ios, android, maccatalyst, windows |
| Depends on | nothing | Klyroo., Klyroo. |
Blazor render modes
The components use plain @onclick handlers, so there is no browser-only code path for the tabs, the filters, the refresh button, sorting and the card menu. What differs between modes is whether those handlers can run. A few features do use JavaScript, and none of them is needed to render a block:
_is a small ES module with one function,content/ Klyroo. Dashboard/ klyroo-dashboard. js downloadText, that saves a file. It is imported on demand (import()through JS interop) the first time the user clicks Download CSV andKlyDashboardhas no handler. Nothing is loaded before that click, and a handler replaces it (see .NET MAUI Blazor Hybrid).Card. OnCsvExported - The copy button of
KlyDashboardcallsDetails navigator.through JS interop. It does nothing outside an interactive render mode.clipboard. writeText - The chart tooltip with its arrow-key exploration (
KlyChart) and the Expand dialog (KlyModal) are custom elements of Klyroo.UI, loaded with the Klyroo.UI script that<KlyApp>adds. The chart tooltip works in static rendering too, since it runs in the browser; opening the Expand dialog is a click handler, so it needs an interactive render mode.
| Render mode | Blocks render | Interaction (tabs, filters, refresh, Retry, sort, menu) |
|---|---|---|
| Static SSR | Yes, with the data your page loaded before rendering | No, the buttons are inert |
| Interactive Server | Yes | Yes |
| Interactive WebAssembly | Yes | Yes |
| Interactive Auto | Yes | Yes |
For a dashboard you almost always want an interactive mode, since the page itself is made of buttons. Add @rendermode Interactive (or Interactive, InteractiveAuto) to the page, as in Getting started.
In Static SSR, await your resources in OnInitialized before the render completes, as the samples do. The page then arrives with its data, but the view tabs, the filter pills and the refresh button do nothing.
Registration. Call AddKlyroo in the server project, and also in the . project when the page can run in WebAssembly (Interactive WebAssembly or Auto). A page that runs in both places needs the services in both.
Prerendering runs your loaders twice. An interactive page is rendered on the server first and then again when the circuit or the WebAssembly runtime starts. Each loader runs once per pass, unless the resource has a json type info and the page attaches its controller to Dashboard and loads with LoadAsync: the prerender then hands the loaded data to the interactive render, which keeps it (see Hand the prerendered data to the interactive render). The loader still runs where the prerender happens, on the server, so in WebAssembly or Auto it must work on both sides. Turn prerendering off for the page if the queries are expensive and too large to hand over, for example @rendermode="new Interactive. Dispose the controller in the page's Dispose so a prerendered pass leaves no AutoRefresh timer behind.
WebAssembly. The loaders run in the browser, so they must call an API your client can reach. The parallel stages are concurrent tasks on the single browser thread, not extra threads.
State is per user. Create the Dashboard in the component, not as a singleton: it holds the filters and data of one user and is not thread-safe.
.NET MAUI Blazor Hybrid
Klyroo. declares ios, android, maccatalyst and windows as supported platforms, which are the platforms a MAUI app targets. In a Hybrid app:
- Add the package to the MAUI project and call
builder.inServices. AddKlyroo Dashboard(); MauiProgram..cs - Reference the stylesheets in
wwwroot/, in the same order as on the web:index. 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.Dashboard/klyroo-dashboard.css" />- Use the components in a Razor page of the
BlazorWebViewas you would in a web app. A Hybrid app renders in the web view on the device, with no server-side prerendering step.
Without a handler, Download CSV starts a browser download through the _ module, which a web view does not always support. In a Hybrid app handle KlyDashboard, which receives the CSV text instead, and write the file with the platform file APIs. The copy button of KlyDashboard uses navigator., which the web views allow for the app's own content.
Native C# MAUI without a web view
If a MAUI app uses XAML or C# markup instead of a BlazorWebView, reference only Klyroo.. It has no ASP.NET Core, Razor or Klyroo.UI dependency. The controller raises a Changed event, not INotify, so a view model subscribes to it and raises its own change notifications. Marshal to the UI thread yourself, since the event comes from whichever thread completed the load.
The repository also holds native views over that controller, Klyroo. (src/): the page, the grid and the thirteen blocks as MAUI controls built on Klyroo., with the same type names in the namespace Klyroo.. It needs the MAUI workload and a checkout of klyroo-ui next to this repository, so it is not part of Klyroo.. Its README lists the controls and what differs from the Blazor ones.
NativeAOT and trimming
Klyroo. sets IsTrimmable and IsAotCompatible, which enables the trim and AOT analyzers when you build it. The CI of this repository builds it with Enable and Enable. The controller, the resources and DashboardFormat use no reflection and no dynamic code. The console app from Getting started publishes with PublishAot on linux-x64, and the native binary runs:
dotnet publish -c Release -p:PublishAot=trueDashboard writes the data with the JsonTypeInfo you give the resource, so that part needs no reflection; two internal calls suppress the trimming warning IL2026 for the string-only Persistent calls, with a justification in the code. Klyroo. is marked IsTrimmable but not IsAotCompatible, and the components inherit from Klyroo.UI. Treat NativeAOT as supported for Klyroo. only. For Blazor WebAssembly, the trimmer is part of the normal publish; this package opts in to it, but this documentation does not make a claim about AOT-compiled WebAssembly builds of the components.
Known limitations
- The block texts follow the Klyroo.UI locale. Only English and French are reviewed.
Klyroo.has no locale, so the default options ofDashboard. Core BooleanandComparisonfilters andDashboardFormat.withoutFormat Relative Time Dashboardstay English.Relative Time Texts - The chart block has the features of
KlyChartbut no zoom, and a donut shows a single series. See the FAQ for what the compact drawing of bar-and-line charts lacks. - More in the FAQ.