To add Masa Blazor Pro to an existing Blazor project, follow these two steps:
1. Include Stylesheets
Add the following links to your wwwroot/index.html (for WebAssembly) or Pages/_Host.cshtml (for Server):
css/masa-blazor-pro.css: Located in your project's wwwroot/css/ directory.{ASSEMBLY NAME}.styles.css: Replace {ASSEMBLY NAME} with your actual project assembly name to enable CSS isolation.
2. Configure the MasaBlazor Theme
Register the MasaBlazor services in your Program.cs and use the UseTheme method to customize colors like Primary and Accent.
<!-- In wwwroot/index.html or Pages/_Host.cshtml -->
<head>
<link href="css/masa-blazor-pro.css" rel="stylesheet">
<link href="{ASSEMBLY NAME}.styles.css" rel="stylesheet">
</head>
// In Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMasaBlazor(builder =>
{
builder.UseTheme(option =>
{
option.Primary = "#4318FF";
option.Accent = "#4318FF";
});
});