Overview
Data lists for Blazor and .NET MAUI Blazor Hybrid: a table and a card grid with search, filters, sorting, paging, selection and bulk actions, for .NET developers who build list pages.
A list page needs search, filters, sort, paging and URL state wired to a data source, and it needs them again on the next page. KlyDataList holds that state, loads rows from memory, an IQueryable or any asynchronous provider, and shares it with parts you compose: table, grid, search field, filter tags, pagination. The state lives in the query string, so the same markup works in static server rendering (links and forms) and in the interactive render modes. The request and filter model comes from Klyroo.Query and the controls are Klyroo.UI components.
Prerequisites
To use the library in an app:
- The .NET 11 SDK, and an app that targets
net11.0. The packages are prereleases, so everydotnet add packagecommand needs--prerelease. - A Blazor app for
Klyroo.: a Blazor Web App or a .NET MAUI Blazor Hybrid app. Selection, the selection bar and actions need an interactive render mode (Interactive Server, WebAssembly or Auto); in static server rendering, sorting, filtering and paging work through links and GET forms. In a WebAssembly or Auto app, register the services in the server project and in theTable .project.Client - Klyroo.UI set up in the app.
Klyroo.brings the Klyroo.UI package, andTable AddKlyrooTable()registers its services, but the layout still needs the Klyroo.UI stylesheets in<head>and<KlyApp>around the body, as described in the Klyroo.UI installation. - Klyroo.Query for the list state;
Klyroo.brings it. To run lists against a database through EF Core, addTable Klyroo.(EF Core 10.0.15 or later). To cut days in the user's time zone in static server rendering, addQuery. Entity Framework Core Klyroo.and callUI. Server AddKlyroo.Server() - A browser with the native popover API, which Klyroo.UI uses: Chrome and Edge 114, Safari 17 or Firefox 125, or later. In a .NET MAUI app, that means iOS or Mac Catalyst 17, or an Android System WebView 114 or later.
- Network access on the first build only if your app self-hosts web fonts (
KlyrooFont), uses icons outside the built-in set, or compiles Tailwind (KlyrooTailwind): the build downloads them once and caches them underobj/. Node.js is not needed.klyroo Klyroo.alone (the tree model) runs in any .NET 11 app.Table. Core
To build this repository you need the .NET 11 SDK (a newer SDK works too, see global.) and clones of klyroo-query and klyroo-ui in the same parent folder: some projects reference them by relative path (../). See Contributing.
Installation
dotnet add package Klyroo.Table --prereleaseRegister the services in Program., in the server project and in the WebAssembly client project if you have one, or in MauiProgram.:
using Klyroo.Table;
builder.Services.AddKlyrooTable();Add the imports to _:
@using Klyroo.UI
@using Klyroo.Table
@using Klyroo.QueryKlyroo.Table ships no stylesheet that is safe to load next to the Klyroo.UI one, so the app compiles Tailwind CSS itself. See Getting started for the stylesheet setup.
For code that needs no UI, install only the core package:
dotnet add package Klyroo.Table.Core --prereleaseQuick start
Headless, with Klyroo.: build the nodes of a tree of rows.
using Klyroo.Query;
using Klyroo.Table;
Employee[] staff =
[
new(1, "Ada", [new(2, "Grace", [new(3, "Alan")]), new(4, "Linus")]),
];
var schema = DataListSchema.For<Employee>(s => s.RowKey(e => e.Id));
var tree = new DataListTree<Employee> { Children = e => e.Reports, DefaultExpandedDepth = 2 };
var (roots, nodes) = tree.BuildTree(staff, schema);
foreach (var node in nodes)
{
Console.WriteLine($"{new string(' ', node.Depth * 2)}{node.Item.Name}");
}
public sealed record Employee(int Id, string Name, IReadOnlyList<Employee>? Reports = null);In a Blazor page, a searchable, sortable, paged table of in-memory rows:
@page "/customers"
<KlyDataList TItem="Customer" Schema="Schema" Items="Customers" Label="Customers" />
@code {
private sealed record Customer(int Id, string Name, string Country, decimal Mrr);
private static readonly DataListSchema<Customer> Schema = DataListSchema.For<Customer>(s => s
.RowKey(c => c.Id)
.Search(c => c.Name, c => c.Country)
.Field(c => c.Name, f => f.Sortable())
.Field(c => c.Country, f => f.Sortable())
.Field(c => c.Mrr, f => f.Sortable()));
private static readonly Customer[] Customers =
[
new(1, "Acme", "France", 1200m),
new(2, "Globex", "Germany", 800m),
new(3, "Initech", "France", 450m),
];
}Without child content the list renders a default layout: a search field (when the schema has search fields), the result count, a refresh button, filter tags (when the schema has filters), a table with one column per schema field, and numbered pagination. Child content replaces that layout with the parts you place.
Documentation
| Getting started | Step-by-step first integration |
| Guides | Task-oriented recipes |
| Concepts | How the library works |
| Platforms | Render modes, .NET MAUI, NativeAOT |
| API reference | Every public type and member |
| FAQ | Troubleshooting and limitations |
Compatibility
- .NET 11 SDK.
- Blazor Web App in static server rendering, Interactive Server, WebAssembly or Auto. In static rendering the controls are links and GET forms; selection and actions need an interactive render.
- .NET MAUI Blazor Hybrid: the package declares
browser,ios,android,maccatalystandwindowsas supported platforms. This repository has no MAUI app or test that runs it. - NativeAOT and trimming:
Klyroo.setsTable. Core IsAotCompatibleandIsTrimmable, and CI builds it with the AOT and trimming analyzers.Klyroo.setsTable IsTrimmableonly. - Tailwind CSS v4 compiled by your app, as described in Getting started.
Contributing
Contributions are welcome. Read CONTRIBUTING.md before opening a pull request, and follow the code of conduct. Report security issues privately as described in SECURITY.md.