Reputation: 6276
In Blazor I want to add the maxlength
attribute to an input
like
<textarea type="text" name="TheNameOfMyField"
class="TheNameOfMyClass" value="" rows="2" maxlength="255">
</textarea>
The component in Blazor is like this one
<InputTextArea @bind-Value="_model.ShortDescription"
class="form-control" id="gapShortDescription" />
and there is no options for maxlength or custom HTML attributes.
How can I do that?
Upvotes: 13
Views: 8010
Reputation: 77606
These built-in components passthrough HTML attributes into the rendered output. Therefore, you can just specify the HTML attributes exactly as you did for the <textarea>
example.
(Note: converting my comment into an answer so we can wrap up this question)
Upvotes: 10