Class RadzenCheckBox<TValue>
A checkbox input component that supports two-state (checked/unchecked) or tri-state (checked/unchecked/indeterminate) modes. RadzenCheckBox provides data binding, validation, and keyboard accessibility for boolean or nullable boolean values. In two-state mode, the value toggles between true and false. In tri-state mode (TriState = true), the value cycles through false → null → true → false. Supports keyboard interaction (Space/Enter to toggle) and integrates with Blazor EditContext for form validation.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenCheckBox<TValue> : FormComponent<TValue>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of the bound value. Typically bool for two-state or bool? for tri-state checkboxes. |
Examples
Basic two-state checkbox:
<RadzenCheckBox @bind-Value=@isChecked TValue="bool" />
Tri-state checkbox with change handler:
<RadzenCheckBox @bind-Value=@nullableBool TValue="bool?" TriState="true" Change=@(args => Console.WriteLine($"Value: {args}")) />
Read-only checkbox for display purposes:
<RadzenCheckBox Value=@isEnabled TValue="bool" ReadOnly="true" />
Constructors
RadzenCheckBox()
A checkbox input component that supports two-state (checked/unchecked) or tri-state (checked/unchecked/indeterminate) modes. RadzenCheckBox provides data binding, validation, and keyboard accessibility for boolean or nullable boolean values. In two-state mode, the value toggles between true and false. In tri-state mode (TriState = true), the value cycles through false → null → true → false. Supports keyboard interaction (Space/Enter to toggle) and integrates with Blazor EditContext for form validation.
Declaration
public RadzenCheckBox()
Examples
Basic two-state checkbox:
<RadzenCheckBox @bind-Value=@isChecked TValue="bool" />
Tri-state checkbox with change handler:
<RadzenCheckBox @bind-Value=@nullableBool TValue="bool?" TriState="true" Change=@(args => Console.WriteLine($"Value: {args}")) />
Read-only checkbox for display purposes:
<RadzenCheckBox Value=@isEnabled TValue="bool" ReadOnly="true" />
Properties
InputAttributes
Gets or sets additional HTML attributes to be applied to the underlying input element. This allows passing custom attributes like data-* attributes, aria-* attributes, or other HTML attributes directly to the input.
Declaration
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | A dictionary of custom HTML attributes. |
ReadOnly
Gets or sets whether the checkbox is read-only and cannot be toggled by user interaction. When true, the checkbox displays its current state but prevents clicking or keyboard toggling. Useful for displaying checkbox state in view-only scenarios.
Declaration
[Parameter]
public bool ReadOnly { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
TriState
Gets or sets whether the checkbox supports three states: checked (true), unchecked (false), and indeterminate (null).
When enabled, clicking cycles through all three states. Use with nullable boolean (bool?) values.
Declaration
[Parameter]
public bool TriState { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Methods
BuildRenderTree(RenderTreeBuilder)
A checkbox input component that supports two-state (checked/unchecked) or tri-state (checked/unchecked/indeterminate) modes. RadzenCheckBox provides data binding, validation, and keyboard accessibility for boolean or nullable boolean values. In two-state mode, the value toggles between true and false. In tri-state mode (TriState = true), the value cycles through false → null → true → false. Supports keyboard interaction (Space/Enter to toggle) and integrates with Blazor EditContext for form validation.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |