alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    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
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    SfBaseComponent
    SfInputBase<TChecked>
    SfCheckBox<TChecked>
    SfRadioButton<TChecked>
    SfSwitch<TChecked>
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(bool)
    SfBaseComponent.GetEffectivePlatform()
    SfBaseComponent.GetMainComponentPlatform()
    SfBaseComponent.IsMainLicenseComponent()
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnObservableChange(string, object, bool, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicense()
    Namespace: Syncfusion.Blazor.Buttons
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public abstract class SfInputBase<TChecked> : SfBaseComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    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
    [Parameter]
    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
    [Parameter]
    public EventCallback<object> Created { get; set; }
    Property Value
    Type Description
    EventCallback<object>

    An EventCallback<TValue> 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
    [Parameter]
    public string CssClass { get; set; }
    Property Value
    Type Description
    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
    [Parameter]
    public bool Disabled { get; set; }
    Property Value
    Type Description
    bool

    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
    [Parameter]
    public bool EnablePersistence { get; set; }
    Property Value
    Type Description
    bool

    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
    [Parameter]
    public bool EnableRtl { get; set; }
    Property Value
    Type Description
    bool

    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
    [Parameter]
    public string Name { get; set; }
    Property Value
    Type Description
    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
    [Parameter]
    public string Value { get; set; }
    Property Value
    Type Description
    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
    Task

    A 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
    Task<string>

    InitRender(bool)

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

    OnAfterRenderAsync(bool)

    Method invoked after each time the component has been rendered.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender

    Set to true for the first time component rendering; otherwise gets false.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfBaseComponent.OnAfterRenderAsync(bool)

    OnInitializedAsync()

    Method invoked when the component is ready to start.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type
    Task
    Overrides
    ComponentBase.OnParametersSetAsync()

    SetLocalStorage(string, TChecked)

    Declaration
    protected Task SetLocalStorage(string persistId, TChecked isChecked)
    Parameters
    Type Name Description
    string persistId
    TChecked isChecked
    Returns
    Type
    Task

    UpdateCheckState(TChecked)

    Declaration
    protected Task UpdateCheckState(TChecked state)
    Parameters
    Type Name Description
    TChecked state
    Returns
    Type
    Task

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved