A label component for associating descriptive text with form input components. RadzenLabel creates accessible labels linked to input fields via the HTML for/id relationship. Provides descriptive text for form inputs, improving usability and accessibility. When properly associated with an input (via the Component property), clicking the label focuses the input. Features association linking to input components via the Component property (matching the input's Name), proper label/input relationships for screen readers, click behavior that focuses the associated input, and content display via Text property or custom content via ChildContent. Always use labels with form inputs for better UX and accessibility compliance. The Component property should match the Name property of the input it describes.
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponent.SetParametersAsync
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenLabel : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRenderBasic label with input:
<RadzenLabel Text="Email Address" Component="EmailInput" />
<RadzenTextBox Name="EmailInput" @bind-Value=@email />
Label with custom content:
<RadzenLabel Component="PasswordInput">
Password <span style="color: red;">*</span>
</RadzenLabel>
<RadzenPassword Name="PasswordInput" @bind-Value=@password />A label component for associating descriptive text with form input components. RadzenLabel creates accessible labels linked to input fields via the HTML for/id relationship. Provides descriptive text for form inputs, improving usability and accessibility. When properly associated with an input (via the Component property), clicking the label focuses the input. Features association linking to input components via the Component property (matching the input's Name), proper label/input relationships for screen readers, click behavior that focuses the associated input, and content display via Text property or custom content via ChildContent. Always use labels with form inputs for better UX and accessibility compliance. The Component property should match the Name property of the input it describes.
public RadzenLabel()Gets or sets custom child content to render as the label text. When set, overrides the Text property for displaying complex label content.
public RenderFragment ChildContent { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets custom child content to render as the label text. When set, overrides the Text property for displaying complex label content. |
Gets or sets the name of the input component this label is associated with. Must match the Name property of the target input component to create the proper label/input relationship. When set, clicking the label will focus the associated input.
public string Component { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the name of the input component this label is associated with. Must match the Name property of the target input component to create the proper label/input relationship. When set, clicking the label will focus the associated input. |
Gets or sets the label text to display. For simple text labels, use this property. For complex content, use ChildContent instead.
public string Text { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the label text to display. For simple text labels, use this property. For complex content, use ChildContent instead. |