StaticInputBase
StaticInputBase is the root abstract class for every headless input-like
component (text inputs, checkboxes, radios, selects). It exposes the bound
ModelExpression, plus the two switches every input needs (ShowLabel and
Disabled).
You usually don’t inherit from StaticInputBase directly — pick the more
specific StaticInput, StaticCheckbox, StaticRadio or StaticSelect for
the element you’re building.
Namespace
Section titled “Namespace”TechGems.StaticComponents.Headlessusing TechGems.StaticComponents.Headless;
namespace YourAssembly.Views.Components;
public abstract class MyInputBase : StaticInputBase { }Public Properties
Section titled “Public Properties”InputExpression
Section titled “InputExpression”[HtmlAttributeName("asp-for")]public ModelExpression? InputExpression { get; set; }The ModelExpression resolved from the consumer-facing asp-for attribute. In
the component’s Razor template you pass this to the inner element via a
static-* tag helper so the original property metadata can be recovered through
the doubly-wrapped expression.
| Attribute | Value |
|---|---|
| HTML attribute | asp-for |
| Required | No |
| Default | null |
ShowLabel
Section titled “ShowLabel”[HtmlAttributeName("show-label")]public bool ShowLabel { get; set; } = true;Lets consumers opt-out of the inline label rendered by your component template.
Default is true.
Disabled
Section titled “Disabled”[HtmlAttributeName("disabled")]public bool Disabled { get; set; }A boolean that maps to the consumer-facing disabled HTML attribute, surfaced as
a C# bool so your template can branch on it without having to parse strings.
Methods
Section titled “Methods”ProcessAsync(TagHelperContext context, TagHelperOutput output)
Section titled “ProcessAsync(TagHelperContext context, TagHelperOutput output)”public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)Delegates to StaticComponent.ProcessAsync, which renders the Razor partial
view associated with the component.
Related
Section titled “Related”- Headless Components — Feature guide.
- StaticInput
- StaticCheckbox
- StaticRadio
- StaticSelect