Table of Contents

Getting started

Install

dotnet add package Tharga.Blazor

Tharga.Blazor targets .NET 10 and .NET 11 and is built on Radzen.Blazor 12. 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)
  • ILocalStorageService from Blazored.LocalStorage — deprecated, see below
  • IOptions<BlazorOptions> for configuration
  • IBlazorLanguageProvider and LanguageResolver (scoped) — both with TryAdd, so registering your own provider replaces the built-in one

The ILocalStorageService registration is deprecated and will be removed in a future major version. No Tharga.Blazor component uses it any more, and Blazored.LocalStorage is archived upstream. If your application injects ILocalStorageService, reference Blazored.LocalStorage and call AddBlazoredLocalStorage() yourself.

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.
  • Upgrading — what to check when moving to a new version.