Reputation: 3573
I want to assign a class
attribute to <InputDate />
component. I tried using AdditionalAttributes
but its syntax is not clear to me. What I ended up with is this:
<InputDate @bind-Value="Model.Task.TaskDate" @attributes="datePickerAttributes" />
@code {
private Dictionary<string,object> datePickerAttributes = new Dictionary<string, object>()
{
["class"] = "form-control"
};
}
It works but looks messy. Is there a more concise way to achieve the same result?
Upvotes: 0
Views: 968
Reputation: 8964
You seem to be overthinking things, you want to assign a class - just do that.
<InputDate @bind-Value="Model.Task.TaskDate" class="form-control" />
Upvotes: 3