Build .NET Web Apps Faster with Blazor & MudBlazor

Blazor and MudBlazor make it easier than ever to build modern, interactive web applications entirely in C#.

In this blog, I’ll teach you how to set up a .NET Blazor project with MudBlazor, scaffold a server-paged data grid, and wire it up to a minimal API—so you can start building fully functional, Material Design-powered apps without leaving C#.

What is Blazor?

Blazor is the ASP.NET Core UI framework that lets you build interactive web apps almost entirely in C# and Razor. You write components once, then choose a hosting model that suits the job: client-side WebAssembly, server-side SignalR, or hybrid desktop/mobile.

Key advantages include a reusable component model, full-stack C# (no context-switching to JavaScript unless you really want to), and tight integration with Visual Studio and the wider .NET tooling pipeline.

What is MudBlazor?

MudBlazor is an open-source Material Design component library for Blazor. It’s written in pure C#, ships via NuGet, and focuses on “zero-JS” developer ergonomics: you drop components, wire C# events, and let MudBlazor handle the styling, animations, and accessibility details.

Project Set-Up

  1. To get started quickly, you can use the dotnet templates provided by MudBlazor. They’re based on the Microsoft “Blazor Web App” template but have been modified to include MudBlazor components.

    dotnet new install MudBlazor.Templates
    dotnet new mudblazor --interactivity Auto --name MudBlazorDemo --all-interactive
  2. This will create a project with all MudBlazor services and components registered, so running the app will show the initial pages with the default theme used

Hands-On Example: Server-Paged Data Grid

  1. Add new class library project MudBlazorDemo.Shared which will contain shared models for server and client projects and add the following records:
public record OrderDto(int Id, string Customer, decimal Total);
public record PageResult<T>(int Total, IEnumerable<T> Data);

2. Reference the newly added project from both existing projects.

3. Create a simple orders repository contract and in-memory implementation of it:

public interface IOrderRepository
{
int Count();

IReadOnlyList<Order> GetPage(int page, int size);
}

public class OrderRepository : IOrderRepository
{
private readonly List<Order> _orders;

public OrderRepository()
{
var random = new Random();
var customerNames = new string[] { "Alice", "Bob", "Taylor", "Marcus", "Elena", "Fritz", "Maria" };

_orders = Enumerable.Range(1, 500).Select(index => new Order
{
Id = index,
Customer = customerNames[random.Next(customerNames.Length)],
Total = random.Next(50, 500),
CreatedUtc = DateTimeOffset.UtcNow.AddDays(-random.Next(90))
}).ToList();
}

public int Count() => _orders.Count;

public IReadOnlyList<Order> GetPage(int page, int size) =>
_orders.OrderBy(o => o.Id)
.Skip(page * size)
.Take(size)
.ToList();
}

4. Register the service into the DI container:

builder.Services.AddSingleton<IOrderRepository, OrderRepository>();

5. Create a minimal-API endpoint which returns paged orders from server:

app.MapGet("/api/orders", (
int page,
int pageSize,
IOrderRepository repo) =>
{
var total = repo.Count();
var orders = repo.GetPage(page, pageSize)
.Select(order => new OrderDto(order.Id, order.Customer, order.Total));

return Results.Ok(new PageResult<OrderDto>(total, orders));
});

6. Add navigation menu item for the orders page:

<MudNavLink Href="orders" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.List">Orders</MudNavLink>

7. Create a page Pages/Orders.razor in the MudBlazorDemo.Client project:

@page "/orders"
@inject HttpClient HttpClient
@using MudBlazor
@using MudBlazorDemo.Shared

<MudPaper Class="pa-4">
<MudTable ServerData="LoadPageAsync"
Hover="true"
Elevation="1">

<HeaderContent>
<MudTh>Id</MudTh>
<MudTh>Customer</MudTh>
<MudTh>Total ($)</MudTh>
</HeaderContent>

<RowTemplate>
<MudTd DataLabel="Id">@context.Id</MudTd>
<MudTd DataLabel="Customer">@context.Customer</MudTd>
<MudTd DataLabel="Total">
@context.Total.ToString("F2")
</MudTd>
</RowTemplate>

<PagerContent>
<MudTablePager />
</PagerContent>
</MudTable>

</MudPaper>

@code {
private async Task<TableData<OrderDto>> LoadPageAsync(TableState tableState, CancellationToken cancellationToken)
{
var pagedOrders = await HttpClient.GetFromJsonAsync<PageResult<OrderDto>>(
$"/api/orders?page={tableState.Page}&pageSize={tableState.PageSize}");

return new TableData<OrderDto>
{
TotalItems = pagedOrders!.Total,
Items = pagedOrders.Data
};
}
}

8. Register HttpClient into dependency injection container: because we use InteractiveAuto render mode and pre-rendering, we need to register it both in the server and client projects:
Server: builder.Services.AddHttpClient();
Client: builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

9. Run the application. You should be able to see a table with the paged orders by navigating to the orders page:

Summary

MudBlazor gives Blazor the “batteries-included” UI layer many teams miss when they first leave the JavaScript world. In a green-field .NET 9 project you can:

  • Start fast – a single NuGet install, a couple of service registrations, and you’re scaffolding pages with fully-styled Material components.
  • Stay in C# – validation, event handling, and data shaping all live in one language and one set of tooling.
  • Scale later – today’s in-memory repository can become an EF Core context, an external REST API, or even a gRPC service without touching the table UI.
  • Ship lighter – MudBlazor’s no-JS philosophy keeps publish size and cognitive overhead low, while Blazor’s build pipeline handles trimming, compression, and AOT for you.

If you need a modern, opinionated component library that feels native to .NET, MudBlazor is a low-friction, high-leverage choice. Glue it to Blazor, wire up the minimal APIs or repositories that make sense for your domain, and focus your energy on delivering features—not chasing CSS classes or bundler configs.

Ready to take your Blazor projects further? Contact Trailhead to discuss how we can help make your software more robust, interactive, and accessible. Happy coding!

Picture of Stefan Mitic

Stefan Mitic

Stefan is an experienced .NET developer from Serbia with seven years in the software industry. Stefan earned his B.S. in Computer Science and at the Faculty of Electrical Engineering, University of Nis. Over the course of his career, he has contributed to various projects, including Geographic Information Systems (GIS), Enterprise Resource Planning (ERP) solutions, Warehouse Management Systems (WMS), and Product Information Management (PIM) systems. Driven by a passion for building high- performance software, he focuses on creating robust, efficient, and scalable solutions. His strengths lie in problem-solving and delivering reliable results. Beyond his professional pursuits, Stefan enjoys tennis, football, playing guitar, and playing chess.

Free Consultation

Sign up for a FREE consultation with one of Trailhead's experts.

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Related Blog Posts

We hope you’ve found this to be helpful and are walking away with some new, useful insights. If you want to learn more, here are a couple of related articles that others also usually find to be interesting:

Exploring What's New in .NET 8

In the early days of the .NET Framework, releases were infrequent and timed with Windows releases. The shift to an open-source platform brought a welcome change. Now, we anticipate an annual .NET release tied to the .NET Conf event every No

Read More

SignalR Scaling with Azure SignalR Service

SignalR is the best way to enable real-time communication in modern .NET web applications. So let's say you have built your first app with SignalR, deployed it to Azure, and everything is working great. After seeing a huge influx of new use

Read More

Our Gear Is Packed and We're Excited to Explore With You

Ready to come with us? 

Together, we can map your company’s software journey and start down the right trails. If you’re set to take the first step, simply fill out our contact form. We’ll be in touch quickly – and you’ll have a partner who is ready to help your company take the next step on its software journey. 

We can’t wait to hear from you! 

Main Contact

This field is for validation purposes and should be left unchanged.

Together, we can map your company’s tech journey and start down the trails. If you’re set to take the first step, simply fill out the form below. We’ll be in touch – and you’ll have a partner who cares about you and your company. 

We can’t wait to hear from you! 

Thank you for reaching out.

You’ll be getting an email from our team shortly. If you need immediate assistance, please call (616) 371-1037.