Getting started
Install
dotnet add package Tharga.Blazor
Tharga.Blazor targets .NET 9 and .NET 10 and is built on Radzen.Blazor. It works with both Blazor Server and Blazor WebAssembly.
Register services
In Program.cs:
builder.Services.AddThargaBlazor(o => o.Title = "My Application");
Or bind from configuration:
builder.Services.AddThargaBlazor(configuration: builder.Configuration);
Combine both — code overrides configuration:
builder.Services.AddThargaBlazor(o => o.Title = "My App", configuration: builder.Configuration);
With the configuration overload, settings come from the Tharga:Blazor section in appsettings.json:
{
"Tharga": {
"Blazor": {
"Title": "Application Name",
"ShowExceptionDetails": false,
"Language": "En"
}
}
}
ShowExceptionDetails lets CustomErrorBoundary render exception messages and stack traces. It is off unless set — turn it on in appsettings.Development.json only, or from code with o.ShowExceptionDetails = builder.Environment.IsDevelopment(). See Error boundary.
Language sets the application-wide language for DateTimeView and TimeSpanView — En or Sv. Unset, they follow CultureInfo.CurrentUICulture and fall back to English. A site serving several tenants resolves it per circuit instead; see Date and duration views.
AddThargaBlazor registers:
BreadCrumbService(scoped)ILocalStorageServicefrom Blazored.LocalStorageIOptions<BlazorOptions>for configurationIBlazorLanguageProviderandLanguageResolver(scoped) — both withTryAdd, so registering your own provider replaces the built-in one
Add the Radzen prerequisites
Tharga.Blazor components delegate styling and the notification surface to Radzen. Wire Radzen in your root layout so notifications and dialogs work:
@* App.razor / MainLayout.razor *@
<RadzenComponents />
And in Program.cs:
builder.Services.AddRadzenComponents();
First component
Render the breadcrumb trail anywhere — it reads the current route automatically:
<BreadCrumbs />
Drop a copy button next to an inline value:
<CopyButton Content="@correlationId" Size="ButtonSize.ExtraSmall" />
Next steps
- Buttons —
ActionButton,StandardButton,CopyButton,CancelButton. - Breadcrumbs — virtual segments, query-param promotion, relinking.
- Error boundary — correlation-id logging, access-denied handling, stack-trace opt-in.