I want to change the color of the required field symbol (asterisk) to red

106 views Asked by At

I want to change the color of the required field symbol (asterisk) to red.I'am using Mud-Blazor. I tried it using the below code. this is the image after i apply the code This is the code i'm using for asterisk to show in red color.

<style>
 .mud-input-required::before {
  content: "*";
  color: red;
  margin-right: 2px;
    }

  .mud-label {
   display: flex;
   align-items: center;
    }
</style>
1

There are 1 answers

1
Suryateja KONDLA On BEST ANSWER
<MudTextField @bind-Value="HelperText" Class="red-asterisk-required" Label="With Helper" Variant="Variant.Outlined" />
<br>
<MudTextField @bind-Value="HelperText" Label="With Helper" Variant="Variant.Outlined" />

<style>
.red-asterisk-required .mud-input-label::after {
    content: " *";
    color: red;
}
</style>

@code {
    public string HelperText { get; set; }
}

refer this Link https://try.mudblazor.com/snippet/wOQIEbEdfXffXybS