Class SfInputBase<TValue>
Represents the base class for text-based input components in the Syncfusion.Blazor.Toolkit library.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Blazor.Toolkit.Inputs
Assembly: Syncfusion.Blazor.Toolkit.dll
Syntax
public abstract class SfInputBase<TValue> : SfBaseComponent, IAsyncDisposable
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of the value representing the input data. |
Remarks
This abstract class provides the foundational functionality for text-based input components in the Blazor Toolkit suite. It handles common input operations such as validation, floating labels, clear button functionality, and accessibility features.
Constructors
SfInputBase()
Declaration
protected SfInputBase()
Properties
CssClass
Gets or sets a CSS class string to customize the appearance of the component.
Declaration
public string CssClass { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A System.String containing CSS class names separated by spaces to customize the appearance. The default value is null. |
Disabled
Gets or sets a value that indicates whether the component is disabled.
Declaration
public bool Disabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
EnablePersistence
Gets or sets whether to persist component's state between page reloads. When set to true, the Value property is persisted.
Declaration
public bool EnablePersistence { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | A System.Boolean indicating whether the component's state persistence is enabled. The default value is false. |
Remarks
The Value property will be stored in browser local storage to persist component's state when page reloads.
ID
Gets or sets the ID of the component.
Declaration
public string ID { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A System.String representing the identifier of the component. The default value is auto-generated. |
Remarks
The ID property allows the component to be uniquely identified in the rendered HTML markup. If a custom ID is not set, the component's ID will be auto-generated, and it may not be as descriptive as required.
ValidateOnInput
Gets or sets a value indicating whether validation should be performed on each input change rather than only on blur.
Declaration
public bool ValidateOnInput { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | A System.Boolean indicating whether validation should be performed during typing. The default value is false. |
Remarks
When set to true, this property enables real-time validation as the user types, providing immediate feedback.
When false (default behavior), validation occurs only when the component loses focus, which is the standard form validation pattern.
Note: The ValueChanged event will still be fired after the component loses focus regardless of this setting.
Value
Gets or sets the current value of the input component.
Declaration
public TValue Value { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue | A value of type |
Remarks
This property supports two-way data binding and will automatically trigger the ValueChanged event when modified.
The value type is determined by the generic type parameter TValue.
ValueChanged
Gets or sets the event callback that is triggered when the value of the component changes.
Declaration
public EventCallback<TValue> ValueChanged { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.AspNetCore.Components.EventCallback<TValue> | An Microsoft.AspNetCore.Components.EventCallback<> representing the value change event handler. The callback receives a |
Remarks
This callback is essential for two-way data binding and is automatically invoked when the component's value is modified. Use this to respond to value changes and update the application state accordingly.