Skip to content

Blazor data listswith URL state.

KlyDataList holds search, filters, sort and paging for rows from memory, an IQueryable or any async provider, and keeps the state in the query string.

Install dotnet add package Klyroo.Table --prerelease
The Klyroo.Table line and its 5 stations
Klyroo.Table
  1. Schema
  2. URL state
  3. Paging
  4. Selection
  5. Columns
KlyrooStack Klyroo.Stack, the interchange of the network
Customers.razor 14 lines
Customers.razor
<KlyDataList TItem="Customer" Schema="Schema"
             Items="Customers" />

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()
      .Filter(DataListFilter.Option()))
    .Field(c => c.Mrr, f => f.Sortable()
      .Filter(DataListFilter.Number(min: 0)))
    .DefaultSort(c => c.Name)
    .DefaultPageSize(5));

Search reads the fields you list, here the name and the country of a customer.

The list sample data
co
Country is France Add filter
Customer Country MRR
LumecoFrance$1,980
NordicoFrance$1,640
Coastline PayFrance$1,330
Cooper & ValeFrance$1,120
ScopeworksFrance$940
Showing 6 to 10 of 11
The address it writes no code needed
/customers?q=co&s=-mrr&f.country=France&p=2

q: the text search, over Name and Country s: the sort; a leading - is descending f.country: one key per filter p: the page; a value equal to its default is left out the whole state is in the address

Beyond the first list

Sort by several columns

Shift+click on a header adds a column to the sort, and each sorted header shows its place in the list. The sort is one key of the address.

Read the guide
Razor
<KlyDataListSortMenu TItem="Order" Multiple="true" />
Sorted by team, then by salary sample data
Employee Team1 Salary2
Mira CostaDesign91,000
Joel TranDesign84,000
Rui FerrazEngineering128,000
Nina AhoEngineering119,000

?s=team|-salary

Expand a row to see details

DetailTemplate adds a button to every row and draws your markup in a full-width row below it. Which rows are open is state you can read and set from code.

Read the guide
Razor
<KlyDataList TItem="Order" Schema="Schema" Items="_orders">
    <KlyDataListTable TItem="Order">
        <DetailTemplate Context="order">
            <dl>
                <dt>Ship to</dt><dd>@order.Address</dd>
                <dt>Lines</dt><dd>@order.LineCount</dd>
            </dl>
        </DetailTemplate>
        <ChildContent>
            <KlyDataListFieldColumn TItem="Order" Field="customer" Title="Customer" />
            <KlyDataListFieldColumn TItem="Order" Field="total" Title="Total" Format="C0" />
        </ChildContent>
    </KlyDataListTable>
</KlyDataList>
Orders, one row open sample data
DetailsCustomerTotal
Acme$1,200
Globex$800
Ship to
12 Harbor Road
Lines
3
Initech$450

Export what the user sees

One component downloads the visible columns as CSV: this page, the selection or every result. Text that a spreadsheet would run as a formula gets an apostrophe in front.

Read the guide
Razor
<KlyDataList TItem="Order" Schema="Schema" Items="_orders"
             Label="Orders" Selectable="true">
    <KlyDataListExport TItem="Order" FileName="orders"
                       CsvOptions="@(new DataListCsvOptions { Delimiter = ';' })" />
    <KlyDataListTable TItem="Order">
        <KlyDataListFieldColumn TItem="Order" Field="customer" Title="Customer" />
        <KlyDataListFieldColumn TItem="Order" Field="total" Title="Total" Format="C2" />
    </KlyDataListTable>
</KlyDataList>
The export button sample data
A cell holding=SUM(A1:A9)
is written as'=SUM(A1:A9)

Everything it does

Three row sources
Pass in-memory Items, a database Queryable run by a replaceable IDataListQueryExecutor, or a Provider delegate that loads a page from an API.
One schema for search, filters and sort
A DataListSchema<T> declares which fields sort, filter and search, and requests are sanitized against it before they reach the data.
State in the URL
Search, filters, sort, page, page size and layout are written to the query string by default, so Back, shared links and static server rendering work; @bind-State reads and sets it from your code.
Table, card grid and phone summary rows
The same list renders as a table, as cards, or as compact rows below the md breakpoint.
Three paging modes
Numbered pages, keyset cursor paging with an infinite loader, or no paging; the table can virtualize rows in the last two.
Selection and actions
Checkbox column, a bulk action bar that can target every result of a query, per-row actions with confirmation dialogs, and a toolbar actions menu.
Grouping, totals and trees
Collapsible row groups, footer aggregates (sum, average, count, min, max) and a headless DataListTree<T> for hierarchical rows.
Multi-column sort
Shift+click appends a column to the sort, headers number the sorts, and the sort menu edits the list.
CSV export
KlyDataListExport downloads the visible columns as the user sees them (this page, the selection or every result), with formula-injection protection, a culture-aware delimiter and an OnExport hook for MAUI.
Master-detail
DetailTemplate draws an expandable full-width row under each row, driven by the row expansion state of the list.
Row hooks
RowHref stretches an accessible link over each row (static renders too), OnRowClick reports clicks and Enter on a row with the modifier keys, and RowClass, RowAttributes and CellClass style rows and cells from the data.
Column control
Show, hide, reorder, pin and resize columns, with preferences kept in a cookie (or localStorage in a MAUI web view).

Packages

  • UI-free tree model (DataListTree<T>) built on Klyroo.Query.Core. NativeAOT compatible and trimmable.
  • The Blazor components, AddKlyrooTable(), themes and 12 message tables. Depends on Klyroo.Table.Core, Klyroo.Query and Klyroo.UI.

Install it, then open the first page.

Change here for the other lines

  • Klyroo.UI Accessible Blazor components for the web and .NET MAUI Blazor Hybrid, styled with Tailwind CSS v4
  • Klyroo.Query Typed query model, URL state sync, and IQueryable / EF Core execution
  • Klyroo.Table Data lists with table and card-grid layouts, filters, selection and actions
  • Klyroo.Form Schema-driven forms, validation and wizards
  • Klyroo.Dashboard Dashboard controller, filters and Blazor blocks: stats, gauges, charts, tables and feeds
  • Klyroo.Display Code highlighting, secret and file list components, media player controls and file preview
  • Klyroo.Spreadsheet Import wizard for CSV, TSV and pasted data, with column and value mapping
  • Klyroo.Agent Bridge that lets AI agents read and act on Klyroo forms, dashboards and imports
  • Klyroo.Hotkey Server-side .NET client for Hotkey cloud browsers, human handoffs and signed webhooks
  • Klyroo.Stack Meta-package, MCP documentation server and dotnet new templates