Add TextTemplate parameter to RadzenFormField Blazor component (#2123)

* Update RadzenFormField.razor

* Update RadzenFormField.razor.cs
This commit is contained in:
Victor Ureta
2025-04-24 01:25:02 -04:00
committed by GitHub
parent 104cc7c900
commit 6fed13bf12
2 changed files with 8 additions and 2 deletions

View File

@@ -13,7 +13,7 @@
</div>
}
@ChildContent
<label class="rz-form-field-label rz-text-truncate" for=@Component>@Text</label>
<label class="rz-form-field-label rz-text-truncate" for=@Component> @if (TextTemplate is null) {@Text} else {@TextTemplate} </label>
@if (End != null)
{
<div class="rz-form-field-end">

View File

@@ -106,7 +106,13 @@ namespace Radzen.Blazor
/// </example>
[Parameter]
public RenderFragment Helper { get; set; }
/// <summary>
/// Gets or sets the custom content for the label using a Razor template.
/// When provided, this template will be rendered instead of the plain text specified in the Text parameter.
/// </summary>
[Parameter]
public RenderFragment TextTemplate { get; set; }
/// <summary>
/// Gets or sets the label text.
/// </summary>
@@ -166,4 +172,4 @@ namespace Radzen.Blazor
return ClassList.Create($"rz-form-field rz-variant-{Enum.GetName(typeof(Variant), Variant).ToLowerInvariant()}").AddDisabled(disabled).Add("rz-floating-label", AllowFloatingLabel == true).ToString();
}
}
}
}