Installation Guide
Get up and running
KBlazor is hosted at kblazor.com. Follow the steps below to add it to your Blazor Server project.
1
Add the NuGet package source
KBlazor is hosted on a custom NuGet feed. Add the source to your nuget.config (or via the CLI):
nuget.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="KBlazorFeed" value="https://nuget.kblazor.com/v3/index.json" /> </packageSources> </configuration>
.NET CLI
dotnet nuget add source https://nuget.kblazor.com/v3/index.json --name KBlazorFeed
The feed URL is
https://nuget.kblazor.com/v3/index.json — no authentication required.
2
Install the package
Add KBlazor to your project using your preferred tool.
.NET CLI
dotnet add package KBlazorPackage Manager Console
Install-Package KBlazorPackageReference (csproj)
<PackageReference Include="KBlazor" Version="*" />
KBlazor requires MudBlazor 8.x and .NET 8 or later.
If MudBlazor isn't in your project yet, it will be added automatically as a transitive dependency.
3
Register services in Program.cs
KBlazor needs three scoped services and MudBlazor's service collection.
Program.cs
using KBlazor.Services; using MudBlazor.Services; // MudBlazor (required by KBlazor components) builder.Services.AddMudServices(); builder.Services.AddHttpContextAccessor(); // KBlazor — provide your own implementations or use the in-memory stubs builder.Services.AddScoped<IFlexTableSettings, YourFlexTableSettings>(); builder.Services.AddScoped<IListViewSettingStore, YourListViewSettingStore>(); builder.Services.AddScoped<IEntityLookupProvider, YourEntityLookupProvider>();
IFlexTableSettings
Controls whether personal views are enabled and which roles have admin access.
IListViewSettingStore
Persists named FlexTable views (column selection, sort, filters) per user.
IEntityLookupProvider
Powers the
[AutoComplete] attribute — returns search results for related entities.4
Add namespaces to _Imports.razor
Add these usings so every component in your project can reference KBlazor types without qualification.
_Imports.razor
@using KBlazor.Components @using KBlazor.Models @using KBlazor.Services @using MudBlazor
5
Decorate your model with attributes
KBlazor reads [Display] attributes to build columns and form fields automatically. Additional attributes control editing behaviour, sorting, and rendering.
Order.cs
public class Order { [Display(Name = "Order #", Order = 1)] [ReadOnlyOnEdit] public string Name { get; set; } [AutoComplete] public Guid? CustomerId { get; set; } public virtual Customer? Customer { get; set; } // Computed property — displays customer name, sorts on Customer.Name [Display(Name = "Customer", Order = 2)] [SortAndFilterOn(Member = "Customer.Name")] public string CustomerName => Customer?.Name ?? string.Empty; [Display(Name = "Amount", Order = 3)] [DisplayNoWrap] public decimal Amount { get; set; } [Display(Name = "Notes", Order = 4)] [MemoDisplay] public string Notes { get; set; } }
The
Fields parameter on FlexTable and BasicEdit matches against
[Display(Name = "...")] values. See the
Attributes reference
for the full list of available attributes.
✓
You're ready
Drop a component into any page and start building.
Example.razor
<FlexTable TItem="Order" Items="@orders" Fields="Order #,Customer,Amount,Notes" SortFilter="OnSortFilter" />