<text-area-input>

The <text-area-input> tag helper is used to create <textarea> elements.

The <text-area-input tag helper generates error messages if its corresponding model member fails validation.

The <text-area-input> tag helper renders child content as a raw HTML child of the generated <label>.

Usage notes

Basic usage

To use the <text-area-input> tag helper, all you need to do is add it to the form and supply the asp-for attribute, just like you would with the built-in <textarea> tag helper:

public class MyModel : PageModel
{
[BindProperty]
public string Biography { get; set; }
}
@model MyModel

<form>
<text-input asp-for="Biography" />
</form>

Generated HTML

The HTML generated by the <text-input> tag helper looks like this:

<div> <!-- component wrapper -->
<div> <!-- input block wrapper -->
<div> <!-- label wrapper, disable in configuration -->
<label for="Biography">
User bio
</label>
</div>

<div> <!-- textarea wrapper, disable in configuration -->
<textarea id="Biography"
name="Biography">
</textarea>
</div>
</div>

<ul> <!-- error wrapper, only rendered if errors are present -->
<li>...</li>
</ul>
</div>

Notes

  • No child content support The <text-area-input> tag helper does not currently support passing child content to be used as the <label> child content. This feature is targeted for a future release.