Installation

Getting started with MudBlazor for faster and easier web development.

Templates

We provide ready to run blazor style templates that comes pre configured with everything you need to get going faster.

You will find them in the Github repository called MudBlazor.Templates and each template comes with both WASM and Server versions.

Manual Install

1. Install the package

Find the package through NuGet Package Manager or install it with following command.

dotnet add package MudBlazor

2. Add Imports

After the package is added you need to add the following in your _Imports.razor

@using MudBlazor

3. Add CSS & Font references

Add the following to your HTML head section, it's either index.html or _Host.cshtml depending on whether you're running WebAssembly or Server.

<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />

Note: If you're installing on a fresh Blazor template make sure to remove everything in your site.css and remove the bootstrap.min.css completely from either index.html or _Host.cshtml.

In the HTML body section of either index.html or _Host.cshtml add this:

<script src="_content/MudBlazor/MudBlazor.min.js"></script>

4. Register Services

For Blazor WebAssembly add the following to your Program.Main

using MudBlazor.Services;

public static async Task Main(string[] args)
{
    var builder = WebAssemblyHostBuilder.CreateDefault(args);
    builder.RootComponents.Add<App>("app");

    builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
    builder.Services.AddMudServices();

    await builder.Build().RunAsync();
}

For Blazor Server add the following in your Startup.cs under ConfigureServices

using MudBlazor.Services;

public void ConfigureServices(IServiceCollection services)
{
    services.AddMudServices();
}

5. Add Components

Add the following components to your MainLayout.razor or App.razor note that the ThemeProvider is essential for MudBlazor but the rest is optional.

<MudThemeProvider/>
<MudDialogProvider/>
<MudSnackbarProvider/>
Now build and run your project, if you didn't get any errors, your good to go.
Jump over to the usage guide to get started.

An error has occurred. This application may no longer respond until reloaded. Reload 🗙