menu

Blazor

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

    Show / Hide Table of Contents

    Class SfInputBase<TChecked>

    Provides a base class for form input components in Syncfusion Blazor, encapsulating common functionality and API contracts for input controls with checked/value states.

    Inheritance
    System.Object
    SfBaseComponent
    SfInputBase<TChecked>
    SfCheckBox<TChecked>
    SfRadioButton<TChecked>
    SfSwitch<TChecked>
    Inherited Members
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(Boolean)
    SfBaseComponent.GetEffectivePlatform()
    SfBaseComponent.GetMainComponentPlatform()
    SfBaseComponent.IsMainLicenseComponent()
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicense()
    Namespace: Syncfusion.Blazor.Buttons
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public abstract class SfInputBase<TChecked> : SfBaseComponent
    Type Parameters
    Name
    TChecked
    Remarks

    This abstract class defines core implementation for form-oriented input elements—such as checkboxes and radio buttons—offering consistent property contracts for Checked/Value/CssClass/Name, support for form integration, RTL rendering, persistence, and extensible rendering. Component developers should inherit this base to ensure seamless interop, accessibility, and persistence with Syncfusion’s form controls.

    Examples

    See SfCheckBox or SfRadioButton for real-world usage and parameter pattern derived from SfInputBase<TChecked>.

    Constructors

    SfInputBase()

    Declaration
    protected SfInputBase()

    Properties

    Checked

    Gets or sets a value indicating whether this input component is checked/selected.

    Declaration
    public TChecked Checked { get; set; }
    Property Value
    Type Description
    TChecked

    A value of type TChecked (such as bool for Checkbox or string for RadioButton). The default is false for checkboxes.

    Remarks

    The Checked property controls the selection state and determines whether the control is rendered as checked (or selected) in the UI. Changing this value updates the state and triggers form events.

    Examples
    <SfCheckBox Checked="true" />

    Created

    Gets or sets an event callback that is invoked when the component has completed its initial rendering.

    Declaration
    public EventCallback<object> Created { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<System.Object>

    An Microsoft.AspNetCore.Components.EventCallback<> delegate executed on component creation.

    Remarks

    Register the Created event callback to perform custom post-initialization logic or notifications.

    Examples
    <SfCheckBox Created="OnCheckBoxCreated" />
    @code {
        private void OnCheckBoxCreated(object args) {
            // Custom logic here
        }
    }

    CssClass

    Gets or sets the CSS class string(s) used for customizing the visual appearance of this input component.

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

    Accepts a CSS class string or whitespace-separated classes to apply appearance customization. The default value is String.Empty.

    Remarks

    The CssClass property allows custom styling of the input container to match application theming or branding needs.

    Examples
    <SfCheckBox CssClass="e-custom" />

    Disabled

    Gets or sets a boolean value indicating whether this component is disabled and non-interactive.

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

    true if the control should be disabled (unresponsive to user input); otherwise, false. The default value is false.

    Remarks

    When Disabled is set to true, the component is not interactive and visually appears disabled on the UI.

    Examples
    <SfRadioButton Disabled="true" />

    EnablePersistence

    Gets or sets a value indicating whether component's checked state should be persisted across browser reloads.

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

    true to enable client persistence using browser local storage, otherwise false. Default is false.

    Remarks

    This stores the Checked property value in the user's local storage, enabling the control to remember its state between page reloads.

    Examples
    <SfRadioButton EnablePersistence="true" />

    EnableRtl

    Gets or sets a value indicating whether to render the component in right-to-left (RTL) layout.

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

    true enables RTL layout for languages such as Arabic or Hebrew; otherwise, false. The default is false.

    Remarks

    Use EnableRtl to align the directionality of the component with right-to-left language application support.

    Examples
    <SfCheckBox EnableRtl="true" />

    Name

    Gets or sets the HTML name attribute of the input element, used for form submission scenarios.

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

    A string representing the input's form field name. The default value is String.Empty.

    Remarks

    Set the Name property to identify this component's value when the surrounding form is submitted. This is essential for integration with HTML forms and server-side model binding.

    Examples
    <SfRadioButton Name="myRadioValue" />

    Value

    Gets or sets the value to submit for the input control when included in form data.

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

    A string representing the value assigned to the input. The default value is String.Empty.

    Remarks

    The Value property allows setting or retrieving the value sent to the server during a form submission.

    Examples
    <SfCheckBox Value="mycheckboxValue" />

    Methods

    FocusAsync()

    Sets focus to this input component, allowing user interaction or keyboard events.

    Declaration
    public Task FocusAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous focus operation.

    Remarks

    Call this method programmatically to move focus to the component, enabling accessibility, keyboard navigation, or workflow scenarios. The actual focus is performed via Blazor JS interop.

    Examples
    await checkboxRef.FocusAsync();

    GetPersistData()

    Declaration
    protected Task<string> GetPersistData()
    Returns
    Type
    System.Threading.Tasks.Task<System.String>

    InitRender(Boolean)

    Declaration
    protected virtual void InitRender(bool isDynamic = false)
    Parameters
    Type Name Description
    System.Boolean isDynamic

    OnAfterRenderAsync(Boolean)

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type
    System.Threading.Tasks.Task
    Overrides
    SfBaseComponent.OnAfterRenderAsync(Boolean)

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    System.Threading.Tasks.Task
    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type
    System.Threading.Tasks.Task

    SetLocalStorage(String, TChecked)

    Declaration
    protected Task SetLocalStorage(string persistId, TChecked isChecked)
    Parameters
    Type Name Description
    System.String persistId
    TChecked isChecked
    Returns
    Type
    System.Threading.Tasks.Task

    UpdateCheckState(TChecked)

    Declaration
    protected Task UpdateCheckState(TChecked state)
    Parameters
    Type Name Description
    TChecked state
    Returns
    Type
    System.Threading.Tasks.Task
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved