Skip to content

StaticTextAreaTagHelper

Inherits: TagHelper HTML Target: <textarea>

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.

TechGems.StaticComponents.Headless.TagHelpers
<textarea static-for="@Model.InputExpression"></textarea>
@model PinesTextArea
<textarea static-for="@Model.InputExpression"
disabled="@(Model.Disabled ? "disabled" : null)"
class=""></textarea>
[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.

Only string. Any other type throws ArgumentException.

When processed, the tag helper:

  1. Validates the inner model type is string (throws otherwise).
  2. Sets name, id and the data-val-* attributes through StaticHeadlessUtils.
  3. Populates a value attribute from the model value when no explicit value was authored.
ConditionException
Inner property is not stringArgumentException