StaticTextAreaTagHelper
Inherits: TagHelper
HTML Target: <textarea>
Section titled “InputExpression”
StaticTextAreaTagHelper is the tag helper that powers static-for on
<textarea> elements. It mirrors StaticInputTagHelper but is locked to
string model properties.
This tag helper is used declaratively — apply the static-for attribute
on a <textarea> inside a Razor template for a component inheriting from
StaticInput.
Namespace
Section titled “Namespace”TechGems.StaticComponents.Headless.TagHelpersHTML Target Element
Section titled “HTML Target Element”<textarea static-for="@Model.InputExpression"></textarea>@model PinesTextArea
<textarea static-for="@Model.InputExpression" disabled="@(Model.Disabled ? "disabled" : null)" class="…"></textarea>Public Properties
Section titled “Public Properties”InputExpression
Section titled “InputExpression”[HtmlAttributeName("static-for")]public ModelExpression InputExpression { get; set; }The outer ModelExpression — its .ModelExplorer.Model is expected to be
another ModelExpression bound to the consumer’s string property.
[HtmlAttributeName("type")]public string? Type { get; set; } = null;Reserved for future use. Currently unused by the tag helper.
Supported Model Types
Section titled “Supported Model Types”Only string. Any other type throws ArgumentException.
Behavior
Section titled “Behavior”When processed, the tag helper:
- Validates the inner model type is
string(throws otherwise). - Sets
name,idand thedata-val-*attributes throughStaticHeadlessUtils. - Populates a
valueattribute from the model value when no explicitvaluewas authored.
Error Conditions
Section titled “Error Conditions”| Condition | Exception |
|---|---|
Inner property is not string | ArgumentException |
Related
Section titled “Related”- Headless Components — Feature guide.
- StaticInput
- StaticInputTagHelper — same model for
<input>.