Skip to content

StaticInput

Abstract Inherits: StaticInputBase

StaticInput is the headless base class for free-text <input> and <textarea> components — text, number, date, email, password, etc. It adds no new properties over StaticInputBase; its purpose is to be a clear inheritance target so a UI kit can name and style text-style inputs distinctly from checkboxes, radios and selects.

In the component’s Razor template, bind the inner <input> (or <textarea>) via the static-for tag helper.

TechGems.StaticComponents.Headless
using TechGems.StaticComponents.Headless;
namespace YourAssembly.Views.Components;
public class PinesInput : StaticInput { }
@* ~/Views/Components/PinesInput.cshtml *@
@model PinesInput
@if (Model.ShowLabel)
{
<label static-for="@Model.InputExpression" class=""></label>
}
<input static-for="@Model.InputExpression"
disabled="@(Model.Disabled ? "disabled" : null)"
class="" />
@* consumer view *@
<pines-input asp-for="Form.FullName"></pines-input>
<pines-input asp-for="Form.SignupEmail"></pines-input> @* type inferred from [DataType] *@
<pines-input asp-for="Form.Password" type="password"></pines-input>
  • InputExpression (asp-for)
  • ShowLabel (show-label)
  • Disabled (disabled)

See StaticInputBase for the full descriptions.

ProcessAsync(TagHelperContext context, TagHelperOutput output)

Section titled “ProcessAsync(TagHelperContext context, TagHelperOutput output)”
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)

Delegates to StaticInputBase.ProcessAsync.