Can I selectively apply the MudBlazor theme to a subset of pages/components?

591 Views Asked by At

The MudBlazor docs instruct users to apply the following to either index.html or _Layout.cshtml/_Host.cshtml.

MudBlazor Installation Docs


My Question:

  • Can I apply the MudBlazor theme to a subset of pages/components? And keep Bootstrap in place for the other pages/components?
  • Razor Sections seems like a solution, but I haven't gotten them to work:
1

There are 1 best solutions below

0
Taco On

You could try the following, however disclaimer I have not tried this myself. I'm not sure if this result in conflicts between libraries and because you are loading two libraries there is very likely a performance penalty.

It is possible to configure different layouts for you blazor project.

Create a new layout with MudBlazorLayout.razor

Add @layout MudBlazorLayout on top of the pages that use mudblazor.

You can configure either Bootstrap or MudBlazor as default.

see learn.microsoft for more details.