HeadlessUtils
Static
Section titled “GetLabelContent(ModelExpression modelExpression)”
HeadlessUtils is a public static class with helper methods for headless
component templates. Today it exposes a single method for resolving label text
the same way StaticLabelTagHelper does — useful when you want that resolution
inside a custom template that isn’t built around a <label> element.
Namespace
Section titled “Namespace”TechGems.StaticComponents.HeadlessPublic Methods
Section titled “Public Methods”GetLabelContent(ModelExpression modelExpression)
Section titled “GetLabelContent(ModelExpression modelExpression)”public static string GetLabelContent(ModelExpression modelExpression)Returns the text to render as a label for the given expression.
Resolution order:
- The expression’s
Metadata.DisplayName(i.e. the value of[DisplayName]). - The expression’s
Metadata.PropertyName. string.Empty.
| Parameter | Type | Description |
|---|---|---|
modelExpression | ModelExpression | The expression to derive label content for. |
Returns: string
@using TechGems.StaticComponents.Headless
@model PinesField
<div class="field"> <span class="label">@HeadlessUtils.GetLabelContent(Model.InputExpression)</span> <input static-for="@Model.InputExpression" class="…" /></div>Related
Section titled “Related”- Headless Components — Feature guide.
- StaticLabelTagHelper — uses the same resolution internally.