menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CheckBoxModel<TChecked> - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class CheckBoxModel<TChecked>

    Model class for Syncfusion Blazor CheckBox input, defining properties for appearance, behavior, accessibility, and form support.

    Inheritance
    System.Object
    CheckBoxModel<TChecked>
    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

    true if the CheckBox should be checked (selected); otherwise, false (default).

    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 String.Empty.

    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

    true to render in the disabled state and block interaction (default: false).

    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

    true persists the checked state; false does not (default).

    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

    true if RTL rendering is enabled; otherwise, false (default).

    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 object with properties corresponding to HTML attributes.

    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

    true if indeterminate (not checked nor unchecked), otherwise false. Default is false.

    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

    string representing the component label (default: String.Empty).

    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

    LabelPosition.Before to place the label to the left; LabelPosition.After (default) to the right.

    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

    string for the Checkbox field in the submitted form data.

    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

    string for the form field value for checked state.

    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" };
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved