Table of Contents

Class TwRadioButton<T>

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

Represents a generic radio button input component for Blazor that supports two-way data binding and customizable value types.

public class TwRadioButton<T> : TwBlazorInputComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent, ITwInputComponent

Type Parameters

T

The type of value associated with the radio button. Determines the data type used for binding and value changes.

Inheritance
TwRadioButton<T>
Implements
Inherited Members

Remarks

Use TwRadioButton<T> to create radio button inputs that bind to values of type T. The component supports two-way binding via the SelectedValue and SelectedValueChanged parameters. Radio buttons with the same Name property form a radio button group where only one can be selected at a time. A value of the checkbox can be set using Value.

Constructors

TwRadioButton()

public TwRadioButton()

Properties

Color

Gets or sets the color of the radio button.

[Parameter]
public Color? Color { get; set; }

Property Value

Color?

GroupName

Gets or sets the name from a parent RadioGroup (cascaded value).

[CascadingParameter(Name = "GroupName")]
public string? GroupName { get; set; }

Property Value

string

Name

Gets or sets the name associated with the radio button group.

[Parameter]
public string Name { get; set; }

Property Value

string

Remarks

Radio buttons with the same name form a mutually exclusive group.

SelectedValue

Gets or sets the selected value for the radio button group.

[Parameter]
public T? SelectedValue { get; set; }

Property Value

T

Remarks

When this value matches the radio button's Value, the radio button is checked.

SelectedValueChanged

Gets or sets the callback that is invoked when the selected value changes.

[Parameter]
public EventCallback<T> SelectedValueChanged { get; set; }

Property Value

EventCallback<T>

Remarks

Use this property to handle value change events in two-way data binding scenarios. The callback is triggered when the component's value is updated, allowing parent components to respond to the change.

Value

Gets or sets the current value of the parameter.

[Parameter]
public T Value { get; set; }

Property Value

T

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder