Class CheckBoxModel<TChecked>
Model class for Syncfusion Blazor CheckBox input, defining properties for appearance, behavior, accessibility, and form support.
Inheritance
Namespace: Syncfusion.Blazor.Buttons
Assembly: Syncfusion.Blazor.dll
Syntax
public class CheckBoxModel<TChecked> : Object
Type Parameters
Name |
---|
TChecked |
Remarks
Mirrors the core API surface from components such as SfCheckBox
, and is used for option data, configuration, and serialization scenarios.
Examples
var model = new CheckBoxModel<bool> { Checked = true, Label = "Accept terms", CssClass = "e-bold" };
Constructors
CheckBoxModel()
Declaration
public CheckBoxModel()
Properties
Checked
Gets or sets a value indicating whether the CheckBox is in the checked state.
Declaration
public TChecked Checked { get; set; }
Property Value
Type | Description |
---|---|
TChecked |
|
Remarks
This property sets the initial checked state. For two-way binding or event change tracking, use the CheckedChanged
event or relevant logic in the component.
Examples
var model = new CheckBoxModel<bool> { Checked = true };
CssClass
Gets or sets the CSS class string(s) to apply custom styles to the CheckBox container element.
Declaration
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | Space-separated CSS classes applied to the outer element. Defaults to |
Remarks
Use CssClass
to integrate your own design theme or visual overrides seamlessly.
Examples
var model = new CheckBoxModel<bool> { CssClass = "custom-check" };
Disabled
Gets or sets a boolean value indicating whether the CheckBox is disabled (not interactive).
Declaration
public bool Disabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
The Disabled
property visually and functionally disables the CheckBox input and all events.
Examples
var model = new CheckBoxModel<bool> { Disabled = true };
EnablePersistence
Gets or sets whether to persist the component's checked state between browser reloads via local storage.
Declaration
public bool EnablePersistence { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
When enabled, the checked value is stored in the browser’s local storage and restored after reloads or navigation.
Examples
var model = new CheckBoxModel<bool> { EnablePersistence = true };
EnableRtl
Gets or sets a value indicating whether the CheckBox should render in right-to-left (RTL) layout.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Use EnableRtl
for applications supporting RTL languages such as Arabic or Hebrew.
Examples
var model = new CheckBoxModel<bool> { EnableRtl = true };
HtmlAttributes
Gets or sets a generic collection of additional HTML attributes to apply to the CheckBox input element.
Declaration
public object HtmlAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.Object | Accepts an |
Remarks
Any specified property such as disabled
, value
, etc., overlays standard properties. Inline property value takes precedence.
Examples
var model = new CheckBoxModel<bool> { HtmlAttributes = new { title = "Custom tooltip", aria_label = "sample" } };
Indeterminate
Gets or sets a value indicating whether the CheckBox is in the indeterminate state.
Declaration
public bool Indeterminate { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Indeterminate state is typically used in partial selection scenarios (such as master/detail grids). User action will clear indeterminate by default.
Examples
var model = new CheckBoxModel<bool> { Indeterminate = true };
Label
Gets or sets the caption (label text) that describes the CheckBox purpose.
Declaration
public string Label { get; set; }
Property Value
Type | Description |
---|---|
System.String |
|
Remarks
The Label
text is rendered as a clickable label for accessibility and UX enhancement.
Examples
var model = new CheckBoxModel<bool> { Label = "I agree to the policy" };
LabelPosition
Gets or sets the label position relative to the CheckBox input.
Declaration
public LabelPosition LabelPosition { get; set; }
Property Value
Type | Description |
---|---|
LabelPosition |
|
Remarks
Useful for meeting accessibility guidelines or supporting specific UI layouts.
Examples
var model = new CheckBoxModel<bool> { LabelPosition = LabelPosition.Before };
Name
Gets or sets the name
attribute value for the CheckBox input, used for form submissions.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
|
Remarks
Identifies this CheckBox in a group or for server-side model binding after submit.
Examples
var model = new CheckBoxModel<bool> { Name = "agreement" };
Value
Gets or sets the value
attribute to be sent with form data when the CheckBox is checked.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String |
|
Remarks
Specifies the data sent to the server when the form is submitted and CheckBox is checked.
Examples
var model = new CheckBoxModel<bool> { Value = "yes" };