Building reusable Blazor component libraries in .NET 10 Creating reusable component libraries remains one of the best ways to scale Blazor development. .NET 10 brings several improvements that make component libraries cleaner and more powerful. Create a Razor Class Library dotnet new razorclasslib -n MyComponents -o MyComponents Simple reusable component @* MyButton.razor *@ <button class="btn @CssClass" @onclick="OnClick"> @ChildContent </button> @code { [Parameter] public string CssClass { get; set; } = "btn-primary"; [Parameter] public RenderFragment? ChildContent { get; set; } [Parameter] public EventCallback OnClick { get; set; } } .NET 10 improvements useful for component libraries 1. PersistentState attribute You can now declaratively persist component state: [PersistentState] public string? SelectedValue { get; set; } 2. Better static asset handling Static files (including CSS isolation) get automatic fingerprinting and compression when served from a Razor Class Library. 3. Improved JavaScript isolation JavaScript modules from component libraries remain isolated and are easier to consume. 4. Validation improvements DataAnnotations validation now handles nested types more reliably — useful if your components expose complex models. Best practices - Keep components focused - Use [Parameter] + EventCallback - Prefer CSS isolation (.razor.css) - Document public parameters clearly - Consider the [PersistentState] attribute when your components hold state across prerendering Do you maintain your own Blazor component library, or do you mostly use third-party ones? #dotnet #Blazor #dotnet10 #ASPNETCore #ComponentLibrary #ReusableComponents
Open in Telegram
ASP.NET Core
Subscribers11,100
Avg views per post, 7d766−38% vs prev 7d
ERR6.90%last 7 days
Average views per post by day
By publication day
Show as table
| Date | Avg views per post |
|---|---|
| Nov 6, 2026 | 1,710 |
| Nov 9, 2026 | 1,615 |
| Nov 10, 2026 | 1,590 |
| Nov 11, 2026 | 1,420 |
| Nov 12, 2026 | 1,350 |
| Nov 13, 2026 | 1,395 |
| Nov 14, 2026 | 1,400 |
| Nov 16, 2026 | 1,260 |
| Nov 17, 2026 | 1,290 |
| Nov 18, 2026 | 1,230 |
| Nov 19, 2026 | 1,310 |
| Nov 20, 2026 | 1,300 |
| Nov 23, 2026 | 1,050 |
| Nov 24, 2026 | 925 |
| Nov 25, 2026 | 788 |
| Nov 26, 2026 | 743 |
| Nov 27, 2026 | 607 |
Most viewed this month
- Views1.71KForwards—Reactions10Comments—
- Views1.67KForwards—Reactions6Comments—
- Views1.59KForwards—Reactions3Comments—
- Views1.56KForwards—Reactions4Comments—
Latest posts
Views607−52%vs avg
Forwards—
Reactions—
Comments—
Views743−41%vs avg
Forwards—
Reactions2
Comments—
Views788−38%vs avg
Forwards—
Reactions3
Comments—
Views925−27%vs avg
Forwards—
Reactions1
Comments—
Views1,050−17%vs avg
Forwards—
Reactions2
Comments—
Views1,300+3%vs avg
Forwards—
Reactions4
Comments—
Views1,310+3%vs avg
Forwards—
Reactions4
Comments—
Views1,230−3%vs avg
Forwards—
Reactions4
Comments—
Views1,290+2%vs avg
Forwards—
Reactions—
Comments—
Views1,260−1%vs avg
Forwards—
Reactions4
Comments—