There are many MudButtons and MudMenus in a Blazor page and I am trying to remove repeated properties like Variant="Variant.Outlined" Color="Color.Primary" Size="Size.Medium".
So, I added custom MudButton razor component which inherits MudButton as the followings;
@inherits MudButton
@{
//Is it required?
base.BuildRenderTree(__builder);
}
@code {
protected override void OnInitialized()
{
base.OnInitialized();
this.Variant = Variant.Outlined;
this.Color = Color.Primary;
this.Size = Size.Medium;
}
protected override void OnParametersSet()
{
base.OnParametersSet();
}
}
@inherits MudMenu
@code {
protected override void OnInitialized()
{
this.Variant = Variant.Outlined;
this.Color = Color.Primary;
this.Size = Size.Medium;
this.EndIcon = Icons.Filled.KeyboardArrowDown;
this.IconColor = Color.Primary;
this.AnchorOrigin = Origin.BottomCenter;
}
}
However, the custom MudButton and MudMenu could not be rendered correctly - only text was displayed.
Is it any way to inherit MudComponent with original style kept?
Best regards.