Table of Contents

Class TwInputGroupText

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

Static text in a TwInputGroupAddon, such as a protocol, a currency symbol or a unit, that is read with the input of its TwInputGroup.

public class TwInputGroupText : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent, IDisposable
Inheritance
TwInputGroupText
Implements
Inherited Members

Remarks

The text's id is added to the input's aria-describedby, so a screen reader announces "https://" or "kg" when the input takes focus. Set DescribesInput to false for text that adds nothing for a screen reader user, or that the input's label already says.

Constructors

TwInputGroupText()

public TwInputGroupText()

Properties

ChildContent

Gets or sets content to show instead of Text.

[Parameter]
public RenderFragment? ChildContent { get; set; }

Property Value

RenderFragment

DescribesInput

Gets or sets whether the text is added to the input's aria-describedby. Defaults to true.

[Parameter]
public bool DescribesInput { get; set; }

Property Value

bool

Text

Gets or sets the text to show. ChildContent is shown instead when it is set.

[Parameter]
public string? Text { get; set; }

Property Value

string

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Dispose()

public void Dispose()

Dispose(bool)

Unregisters the text from its group.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

OnParametersSet()

Invoked when the component's parameters have been set. Ensures that the component has a unique identifier by generating one if none is provided.

protected override void OnParametersSet()

Remarks

If the component's identifier is not set, a unique ID is generated based on the component's type name (with a 'Tw' prefix removed if present) and a GUID. This helps ensure that each component instance can be uniquely identified, which is useful for scenarios such as associating labels with form elements or targeting elements in client-side scripts.