13

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?

1
  • Oh, I didn't. And, yes, it is working Commented May 12, 2021 at 23:11

1 Answer 1

10

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.