menu

Blazor

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

    Show / Hide Table of Contents

    Class SfCheckBox<TChecked>

    CheckBox is a graphical user interface element that allows you to select one or more options from the choices. It has checked, unchecked, and indeterminate states.

    Inheritance
    System.Object
    SfBaseComponent
    SfInputBase<TChecked>
    SfCheckBox<TChecked>
    Inherited Members
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(Boolean)
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    SfInputBase<TChecked>.Checked
    SfInputBase<TChecked>.Created
    SfInputBase<TChecked>.CssClass
    SfInputBase<TChecked>.Disabled
    SfInputBase<TChecked>.EnablePersistence
    SfInputBase<TChecked>.EnableRtl
    SfInputBase<TChecked>.FocusAsync()
    SfInputBase<TChecked>.GetPersistData()
    SfInputBase<TChecked>.Name
    SfInputBase<TChecked>.OnInitializedAsync()
    SfInputBase<TChecked>.OnParametersSetAsync()
    SfInputBase<TChecked>.SetLocalStorage(String, TChecked)
    SfInputBase<TChecked>.UpdateCheckState(TChecked)
    SfInputBase<TChecked>.Value
    Syncfusion.Blazor.Buttons.SfInputBase<TChecked>.CheckedChanged
    Syncfusion.Blazor.Buttons.SfInputBase<TChecked>.CheckedExpression
    Syncfusion.Blazor.Buttons.SfInputBase<TChecked>.ChildContent
    Syncfusion.Blazor.Buttons.SfInputBase<TChecked>.HtmlAttributes
    Namespace: Syncfusion.Blazor.Buttons
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfCheckBox<TChecked> : SfInputBase<TChecked>
    Type Parameters
    Name
    TChecked
    Examples

    In the below code example, a basic checkbox is initialized with Checked property.

     
    <SfCheckBox Checked="true"> 
    </SfCheckBox> 

    Constructors

    SfCheckBox()

    Declaration
    public SfCheckBox()

    Properties

    EnableTriState

    Gets or sets a value that indicates whether to enable or disable the tristate in the checkbox.

    Declaration
    public bool EnableTriState { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the checkbox is rendered with tristate. The default value is false.

    Remarks

    The EnableTriState property is working based on Checked and Indeterminate property.

    Indeterminate

    Gets or sets a value that indicates whether to enable or disable indeterminate state in the checkbox.

    Declaration
    public bool Indeterminate { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the checkbox is in indeterminate state. The default value is false.

    Remarks

    The Indeterminate property overrides this Checked property in initial rendering of Checkbox.

    Label

    Gets or sets a value that indicates the label of checkbox.

    Declaration
    public string Label { get; set; }
    Property Value
    Type Description
    System.String

    Accepts a string value. The default value is String.Empty.

    LabelPosition

    Gets or sets a value that indicates how to display label in the checkbox.

    Declaration
    public LabelPosition LabelPosition { get; set; }
    Property Value
    Type Description
    LabelPosition

    One of the LabelPosition enumeration. The default value is Before

    Remarks

    If the LabelPosition is Before, the label will be placed to the left side of the CheckBox. If the LabelPosition is After, the icon will be placed to the right side of the CheckBox.

    ValueChange

    Gets or sets an event callback that is raised when the checkbox state is changed.

    Declaration
    public EventCallback<ChangeEventArgs<TChecked>> ValueChange { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<ChangeEventArgs<TChecked>>

    An event callback function.

    Remarks

    The event is raised for UI based click only.

    Examples
     
    <SfCheckBox ValueChange="@Changed"> 
    </SfCheckBox> 
    @code { 
        private void Changed(ChangeEventArgs<TChecked> args) { 
            // Write your code here. 
        } 
    } 

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    InitRender(Boolean)

    Declaration
    protected override void InitRender(bool isDynamic = false)
    Parameters
    Type Name Description
    System.Boolean isDynamic
    Overrides
    Syncfusion.Blazor.Buttons.SfInputBase<TChecked>.InitRender(System.Boolean)

    OnAfterRenderAsync(Boolean)

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type
    System.Threading.Tasks.Task
    Overrides
    Syncfusion.Blazor.Buttons.SfInputBase<TChecked>.OnAfterRenderAsync(System.Boolean)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved