Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenLabel

    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.

    Inheritance
    object
    ComponentBase
    RadzenComponent
    RadzenLabel
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.OnContextMenu(MouseEventArgs)
    RadzenComponent.GetCssClass()
    RadzenComponent.GetId()
    RadzenComponent.Debounce(Func<Task>, int)
    RadzenComponent.OnInitialized()
    RadzenComponent.SetParametersAsync(ParameterView)
    RadzenComponent.OnAfterRenderAsync(bool)
    RadzenComponent.RaiseContextMenu(MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.AddContextMenu()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Dispose()
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.Reference
    RadzenComponent.CurrentStyle
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenLabel : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    Examples

    Basic 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 />

    Constructors

    RadzenLabel()

    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.

    Declaration
    public RadzenLabel()
    Examples

    Basic 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 />

    Properties

    ChildContent

    Gets or sets custom child content to render as the label text. When set, overrides the Text property for displaying complex label content.

    Declaration
    [Parameter]
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    RenderFragment

    The label content render fragment.

    Component

    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.

    Declaration
    [Parameter]
    public string Component { get; set; }
    Property Value
    Type Description
    string

    The target component's name for label association.

    Text

    Gets or sets the label text to display. For simple text labels, use this property. For complex content, use ChildContent instead.

    Declaration
    [Parameter]
    public string Text { get; set; }
    Property Value
    Type Description
    string

    The label text. Default is empty string.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    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.

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    string
    Overrides
    RadzenComponent.GetComponentCssClass()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT