Globals

A collection of settings that let you control the default behavior or appearance of MudBlazor components.

Warning: This feature is currently under development.

Breaking changes to the API may occur between releases. Please only use MudGlobal if you are prepared to adapt your code and provide feedback or contribute code .

Rendered in 0 ms
Usage

The static

class contains default settings which can override the default settings for MudBlazor components.

The following example changes all components to use a large size, secondary color, and filled variant as their defaults.

Note: Defaults should be set when your application initializes, such as when adding MudBlazor services.

// Add MudBlazor services
Services.AddMudServices();

// Change the default appearance of all MudButton components
MudGlobal.ButtonDefaults.Color = Color.Secondary;
MudGlobal.ButtonDefaults.Size = Size.Large;
MudGlobal.ButtonDefaults.Variant = Variant.Filled;
Exception Handler

A global exception handler is available via the MudGlobal.UnhandledExceptionHandler property.

// Add MudBlazor services
Services.AddMudServices();

// Send all exceptions to the console
MudGlobal.UnhandledExceptionHandler = (exception) => Console.WriteLine(exception);
An unhandled error has occurred. Reload 🗙