Table of Contents

Class TwCheckbox<T>

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

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

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

Type Parameters

T

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

Inheritance
TwCheckbox<T>
Implements
Inherited Members

Remarks

Use TwCheckbox<T> to create checkbox inputs that bind to values of type T. The component supports two-way binding via the Value and ValueChanged parameters. The Name property can be used to associate the checkbox with a form field or for accessibility purposes.

Constructors

TwCheckbox()

public TwCheckbox()

Properties

Color

Gets or sets the color of the checkbox.

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

Property Value

Color?

GroupName

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

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

Property Value

string

Name

Gets or sets the name associated with the component.

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

Property Value

string

Size

Gets or sets the size of the checkbox and its check/dash icon. Defaults to Md, the same dimensions this component has always rendered at.

[Parameter]
public Size Size { get; set; }

Property Value

Size

Value

Gets or sets the current value of the parameter.

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

Property Value

T

ValueChanged

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

[Parameter]
public EventCallback<T> ValueChanged { 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.

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder