I'm currently using MudBlazor and really like it.
However, there are things I find myself repeatedly adding to components like CancellationTokens, are customizing the template myself.
Is there a way to completely inherit/extend an existing component?
One option is to make a new component that has an instance of the component I want to modify, and to add all of the parameters to my component and map them back to the original, but I feel there has got to be a better way.
Attribute splatting is really handy for creating wrappers or higher level abstractions around other components:
<MudTextField Variant="@Variant" @attributes="@OtherAttributes"></MudTextField>
@code {
[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object> OtherAttributes { get; set; }
[Parameter]
// can even set your own defaults
public Variant Variant { get; set; } = "Variant.Filled"
}
You can also create your own base components and use @inherits for shared logic and parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With