MUD0002
Identifies attributes set on MudBlazor components that don't match a defined pattern. This helps prevent component parameter errors due to typos or changes in MudBlazor.
The warning will only indicate the correct .razor file, not the exact location.
Configure the analyzer by adding the code below to your .csproj
file.
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <MudAllowedAttributePattern>LowerCase</MudAllowedAttributePattern> </PropertyGroup>
Option | Description | Default |
---|---|---|
LowerCase |
Only allow lower case attributes | true |
HTMLAttributes |
Only allow a list of valid case sensitive HTML attributes and events including data-*, aria-* and role. The default list of attributes were mainly obtained from https://www.w3schools.com/tags/ref_attributes.asp and https://www.w3schools.com/jsref/dom_obj_event.asp | |
DataAndAria |
Only allow case sensitive data-*, aria-* and role attributes | |
None |
Don't allow any additional attributes | |
Any |
Allows any extra attributes in any case |
Custom Attribute List
The HTMLAttributes option can use a custom list of attributes. Configure this by adding the code below to your .csproj
file.
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <MudAllowedAttributeList>attribute1,attribute2</MudAllowedAttributeList> </PropertyGroup>