menu

Blazor

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

    Show / Hide Table of Contents

    Class SfNumericTextBox<TValue>

    The NumericTextBox is used to get the number inputs from the user. The input values can be incremented or decremented by a predefined step value.

    Inheritance
    System.Object
    SfBaseComponent
    SfInputTextBase<TValue>
    SfNumericTextBox<TValue>
    Inherited Members
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(Boolean)
    SfBaseComponent.GetEffectivePlatform()
    SfBaseComponent.GetMainComponentPlatform()
    SfBaseComponent.IsMainLicenseComponent()
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicense()
    SfInputTextBase<TValue>._value
    SfInputTextBase<TValue>.APPEND
    SfInputTextBase<TValue>.APPEND_ICON
    SfInputTextBase<TValue>.ARIA_DISABLED
    SfInputTextBase<TValue>.BaseAutocomplete
    SfInputTextBase<TValue>.CLEAR_ICON_HIDE
    SfInputTextBase<TValue>.ClearElement
    SfInputTextBase<TValue>.CLEARICONHIDE
    SfInputTextBase<TValue>.ComponentReference
    SfInputTextBase<TValue>.ContainerAttr
    SfInputTextBase<TValue>.containerAttributes
    SfInputTextBase<TValue>.CONTROL_CONTAINER
    SfInputTextBase<TValue>.CONTROL_OLD_CONTAINER
    SfInputTextBase<TValue>.CssClass
    SfInputTextBase<TValue>.DataId
    SfInputTextBase<TValue>.DECREMENT
    SfInputTextBase<TValue>.DECREMENT_TITLE
    SfInputTextBase<TValue>.DecrementTitle
    SfInputTextBase<TValue>.DISABLE
    SfInputTextBase<TValue>.DISABLE_ICON
    SfInputTextBase<TValue>.DISABLED_ATTR
    SfInputTextBase<TValue>.Enabled
    SfInputTextBase<TValue>.EnablePersistence
    SfInputTextBase<TValue>.EnableRtl
    SfInputTextBase<TValue>.FLOATINPUT
    SfInputTextBase<TValue>.FloatLabel
    SfInputTextBase<TValue>.FLOATLABELBOTTOM
    SfInputTextBase<TValue>.FLOATLABELTOP
    SfInputTextBase<TValue>.FLOATTEXT
    SfInputTextBase<TValue>.GROUP_ICON
    SfInputTextBase<TValue>.ID
    SfInputTextBase<TValue>.INCREMENT
    SfInputTextBase<TValue>.INCREMENT_TITLE
    SfInputTextBase<TValue>.IncrementTitle
    SfInputTextBase<TValue>.INPUT
    SfInputTextBase<TValue>.inputAttr
    SfInputTextBase<TValue>.InputEditContext
    SfInputTextBase<TValue>.INPUTFOCUS
    SfInputTextBase<TValue>.INPUTGROUP
    SfInputTextBase<TValue>.InputHandler(ChangeEventArgs)
    SfInputTextBase<TValue>.IsClearButtonClicked
    SfInputTextBase<TValue>.IsFocused
    SfInputTextBase<TValue>.ListOfButtons
    SfInputTextBase<TValue>.MULTILINE
    SfInputTextBase<TValue>.MultilineInput
    SfInputTextBase<TValue>.OnAfterRenderAsync(Boolean)
    SfInputTextBase<TValue>.OnChangeHandler(ChangeEventArgs)
    SfInputTextBase<TValue>.OnInitializedAsync()
    SfInputTextBase<TValue>.OnInputHandler(ChangeEventArgs)
    SfInputTextBase<TValue>.OnParametersSetAsync()
    SfInputTextBase<TValue>.OnPasteHandler(ClipboardEventArgs)
    SfInputTextBase<TValue>.PREPEND
    SfInputTextBase<TValue>.PREPEND_ICON
    SfInputTextBase<TValue>.SetEnabled()
    SfInputTextBase<TValue>.SPACE
    SfInputTextBase<TValue>.SPIN_DOWN
    SfInputTextBase<TValue>.SPIN_UP
    SfInputTextBase<TValue>.ValidateOnInput
    SfInputTextBase<TValue>.Value
    SfInputTextBase<TValue>.ValueChanged
    SfInputTextBase<TValue>.WireClearBtnEvents()
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BlurHandler(System.String, System.Boolean)
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ClickStopPropagation
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ContainerClass
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.IsValueTemplate
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.MouseDowSpinnerPrevent
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.MousePreventContainer
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnBlur
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnChange
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnFocus
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnInput
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.OnPaste
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.PreventIconHandler
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.RootClass
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.SpinButton
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ValueExpression
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ValueTemplate
    Namespace: Syncfusion.Blazor.Inputs
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfNumericTextBox<TValue> : SfInputTextBase<TValue>
    Type Parameters
    Name Description
    TValue

    Specifies the generic type of the SfNumericTextBox<TValue> component. This type determines the data type of the numeric value that can be entered and processed by the component.

    Remarks

    The SfNumericTextBox<TValue> component provides a user-friendly interface for numeric input with features like spin buttons, validation, formatting, and culture-specific number display. It supports various numeric types including int, double, decimal, float, and their nullable counterparts.

    Examples

    A simple NumericTextBox component.

    <SfNumericTextBox TValue="int" Value="10" Min="0" Max="100" Step="1"></SfNumericTextBox>

    Constructors

    SfNumericTextBox()

    Declaration
    public SfNumericTextBox()

    Properties

    BaseFloatLabelType

    Declaration
    protected override FloatLabelType BaseFloatLabelType { get; set; }
    Property Value
    Type
    FloatLabelType
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseFloatLabelType

    BaseHtmlAttributes

    Declaration
    protected override Dictionary<string, object> BaseHtmlAttributes { get; set; }
    Property Value
    Type
    System.Collections.Generic.Dictionary<System.String, System.Object>
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseHtmlAttributes

    BaseInputAttributes

    Declaration
    protected override Dictionary<string, object> BaseInputAttributes { get; set; }
    Property Value
    Type
    System.Collections.Generic.Dictionary<System.String, System.Object>
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseInputAttributes

    BaseIsReadOnlyInput

    Declaration
    protected override bool BaseIsReadOnlyInput { get; set; }
    Property Value
    Type
    System.Boolean
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseIsReadOnlyInput

    BasePlaceholder

    Declaration
    protected override string BasePlaceholder { get; set; }
    Property Value
    Type
    System.String
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BasePlaceholder

    BaseReadonly

    Declaration
    protected override bool BaseReadonly { get; set; }
    Property Value
    Type
    System.Boolean
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseReadonly

    BaseShowClearButton

    Declaration
    protected override bool BaseShowClearButton { get; set; }
    Property Value
    Type
    System.Boolean
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseShowClearButton

    BaseTabIndex

    Declaration
    protected override int BaseTabIndex { get; set; }
    Property Value
    Type
    System.Int32
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseTabIndex

    BaseWidth

    Declaration
    protected override string BaseWidth { get; set; }
    Property Value
    Type
    System.String
    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.BaseWidth

    Currency

    Gets or sets the currency code to use in currency formatting. Possible values are the ISO 4217 currency codes, such as USD for the US dollar and EUR for the euro.

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

    A string value representing the ISO 4217 currency code. The default value is null.

    Remarks

    This property enables currency formatting for the numeric values displayed in the SfNumericTextBox<TValue>. When set, the component will format numbers according to the specified currency's conventions. Common examples include "USD" for US Dollar, "EUR" for Euro, "GBP" for British Pound, etc.

    Examples
    <SfNumericTextBox TValue="decimal?" Currency="USD" Placeholder="Enter amount">
    </SfNumericTextBox>

    Decimals

    Gets or sets the number of decimal places to display for numeric values.

    Declaration
    public Nullable<int> Decimals { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    An integer value representing the number of decimal places. Use null to display the default number of decimal places. The default value is null.

    Remarks

    This property controls the precision of decimal values displayed in the SfNumericTextBox<TValue>. When set to a specific value, the component will format numbers to show exactly that many decimal places. If set to null, the component will use the default decimal precision based on the data type and format string.

    Examples
    <SfNumericTextBox TValue="decimal?" Decimals="3" Placeholder="Enter value">
    </SfNumericTextBox>

    FloatLabelType

    Gets or sets the floating label behavior of the SfNumericTextBox<TValue>. The Placeholder text act as a lable.

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

    One of the FloatLabelType enumeration. The default value is Never

    Remarks

    If the FloatLabelType is Never, the placeholder text does not float as a label. If the FloatLabelType is Auto, the placeholder text will float above the Numeric TextBox component as a label after focusing it. If the FloatLabelType is Always, the placeholder text is displayed as a label above the Numeric TextBox component.

    Examples

    In the following code example, set the float lable as Auto.

      <SfNumericTextBox TValue="int?" Placeholder="Enter the value" FloatLabelType="FloatLabelType.Auto">
      </SfNumericTextBox>

    Format

    Gets or sets the format string used to display numeric values.

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

    A string value representing the format pattern. The default value is n2 which represents a number with two decimal places.

    Remarks

    You can customize the format string according to your requirements. The format string follows the standard format specifiers used in .NET formatting. For example, n3 would display a number with three decimal places.

    Examples
      <SfNumericTextBox TValue="decimal?" Placeholder="Enter the value" Format="n3" >
      </SfNumericTextBox>

    HtmlAttributes

    Gets or sets a collection of additional attributes such as styles, class, and more that will be applied to the SfNumericTextBox<TValue> component.

    Declaration
    public Dictionary<string, object> HtmlAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>

    The value as dictionary collection.The default value is null

    Remarks

    If you configured both property and equivalent html attributes, then the component considers the property value.

    Examples
    <SfNumericTextBox TValue="int?" HtmlAttributes="@CustomAttribute">
    </SfNumericTextBox>
    @code{
        Dictionary<string, object> CustomAttribute = new Dictionary<string, object>()
        {
            { "title", "Please enter the unit" }
        };
    }

    InputAttributes

    Gets or sets a collection of additional inputs attributes such as disabled, value, and more that will be applied to the TextBox component.

    Declaration
    public Dictionary<string, object> InputAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>

    The value as dictionary collection.The default value is null

    Remarks

    Additional attributes can be added by specifying as inline attributes or by specifying @attributes directive. If you configured both property and equivalent html attributes, then the component considers the property value.

    Examples
    <SfNumericTextBox TValue="int?" Placeholder="Enter the PIN" @attributes="@CustomAttribute">
    </SfNumericTextBox>
    @code{
        Dictionary<string, object> CustomAttribute = new Dictionary<string, object>()
        {
            { "maxlength", "4" }
        };
    }

    Max

    Gets or sets the maximum allowable value for the input.

    Declaration
    public TValue Max { get; set; }
    Property Value
    Type Description
    TValue

    The maximum allowable value for the input. The default value is determined by the maximum possible value for the data type.

    Remarks

    This property defines the upper boundary for values that can be entered in the SfNumericTextBox<TValue>. When StrictMode is enabled, values exceeding this maximum will be automatically corrected to this maximum value. When StrictMode is disabled, values can exceed this maximum but will be flagged with an error state. The spin buttons and keyboard interactions respect this maximum limit.

    Examples
    <SfNumericTextBox TValue="int?" Placeholder="Enter the value" Max="10">
    </SfNumericTextBox>

    Min

    Gets or sets the minimum allowable value for the input.

    Declaration
    public TValue Min { get; set; }
    Property Value
    Type Description
    TValue

    The minimum allowable value for the input. The default value is determined by the minimum possible value for the data type.

    Remarks

    This property defines the lower boundary for values that can be entered in the SfNumericTextBox<TValue>. When StrictMode is enabled, values below this minimum will be automatically corrected to this minimum value. When StrictMode is disabled, values can go below this minimum but will be flagged with an error state. The spin buttons and keyboard interactions respect this minimum limit.

    Examples
    <SfNumericTextBox TValue="int?" Placeholder="Enter the value" Min="5">
    </SfNumericTextBox>

    Placeholder

    Gets or sets the text that is displayed when the SfNumericTextBox<TValue> has no value and remove on the focus.

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

    The text that is displayed when the TextBox has no value. The default value is String.Empty.

    Remarks

    The property depends on the FloatLabelType property, The placeholder text acts as a label.

    Readonly

    Gets or sets the boolean value whether the SfNumericTextBox<TValue> allows the user to change the text.

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

    true, if the TextBox component cannot be edited. Otherwise, false.

    ShowClearButton

    Get or sets a value that indicates whether the clear button is displayed in SfNumericTextBox<TValue> component.

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

    true, if the clear button should be shown. Otherwise, false.The default is false.

    ShowSpinButton

    Gets or sets a value indicating whether to display spin buttons for incrementing and decrementing the numeric value.

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

    true if spin buttons should be shown; otherwise, false. The default value is true.

    Remarks

    When enabled, the SfNumericTextBox<TValue> displays up and down arrow buttons that allow users to increment or decrement the numeric value. The spin buttons provide an intuitive way for users to adjust values without typing, especially useful for precise value adjustments. The increment/decrement amount is controlled by the Step property.

    Examples
    <SfNumericTextBox TValue="int?" ShowSpinButton="true" Step="5">
    </SfNumericTextBox>

    Step

    Gets or sets the increment or decrement value for changing the numeric value.

    Declaration
    public TValue Step { get; set; }
    Property Value
    Type Description
    TValue

    The step value that determines how much the numeric value changes when interacting with the component. The default value varies based on the data type.

    Remarks

    This property defines the amount by which the value increases or decreases when users interact with the spin buttons, use keyboard arrow keys, or scroll the mouse wheel. The step value should be appropriate for the expected range and precision of values in your application. For example, use smaller step values for decimal numbers requiring precision, and larger step values for whole numbers.

    Examples
    <SfNumericTextBox TValue="int?" Placeholder="Enter the value" Step="5">
    </SfNumericTextBox>

    StrictMode

    Gets or sets a value indicating whether the component operates in strict mode for value validation.

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

    true if input values are restricted between the minimum and maximum range; otherwise, false. The default value is true.

    Remarks

    When StrictMode is enabled (true), the input value will be automatically constrained between the Min and Max values. If a user enters a value outside this range, it will be corrected to the nearest boundary value when the component loses focus. When disabled (false), the component allows any value, even if it falls outside the specified range. In this case, an error class is applied to highlight invalid values visually.

    Examples
    <SfNumericTextBox TValue="int?" Min="1" Max="100" StrictMode="true">
    </SfNumericTextBox>

    TabIndex

    Gets or sets the tab order of the SfNumericTextBox<TValue> component.

    Declaration
    public int TabIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer value representing the tab index of the component.

    ValidateDecimalOnType

    Gets or sets a value indicating whether to perform decimal validation during typing.

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

    true if decimal validation should be performed during typing; otherwise, false. The default value is false.

    Remarks

    When enabled, this property validates decimal input in real-time as the user types, preventing invalid decimal characters from being entered. This provides immediate feedback and ensures that only valid decimal values can be typed into the SfNumericTextBox<TValue>. When disabled, validation occurs only when the component loses focus or when the value is programmatically set.

    Examples
    <SfNumericTextBox TValue="decimal?" ValidateDecimalOnType="true">
    </SfNumericTextBox>

    Width

    Gets or sets the width of the SfNumericTextBox<TValue> component.

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

    The preferred width in pixels or percentage value. The default value is 100%.

    Examples
      <SfNumericTextBox TValue="int?" Width="200px">
      </SfNumericTextBox>

    Methods

    BuildRenderTree(RenderTreeBuilder)

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

    ChangeHandler(ChangeEventArgs)

    Handles the change event when the input value is modified by the user.

    Declaration
    protected override Task ChangeHandler(ChangeEventArgs args)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.ChangeEventArgs args

    The change event arguments containing the new input value.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous change handling operation.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.ChangeHandler(Microsoft.AspNetCore.Components.ChangeEventArgs)
    Remarks

    This method is responsible for processing user input and performs the following operations:

    • Handles drag-and-drop input sanitization
    • Processes full-width character conversion
    • Validates numeric input against allowed patterns
    • Handles both double and decimal parsing based on data type
    • Applies strict mode constraints and formatting
    • Manages paste operations and invalid input states
    The method supports culture-specific number formatting and ensures proper validation of numeric input.

    DecrementAsync(TValue)

    Decrements the value asynchronously by the specified step.

    Declaration
    public Task DecrementAsync(TValue step)
    Parameters
    Type Name Description
    TValue step

    The step value by which to decrement the current value. If not provided, the numeric value will be decremented based on the Step property value.

    Returns
    Type Description
    System.Threading.Tasks.Task

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

    Remarks

    This method decreases the current value of the SfNumericTextBox<TValue> by the specified step amount. The operation is performed asynchronously and will trigger the change event after the value is updated. If the resulting value goes below the minimum allowed value, it will be constrained to the minimum value.

    Examples
    // Decrement by a custom step value
    await numericTextBox.DecrementAsync(5);
    
    // Decrement by the default step value
    await numericTextBox.DecrementAsync(default(TValue));

    FocusAsync()

    Sets the focus to the NumericTextBox component for interaction.

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

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

    Remarks

    This method programmatically focuses the SfNumericTextBox<TValue> component, making it ready for user input. When focused, the component will be highlighted and ready to receive keyboard input or other user interactions. This is useful for accessibility scenarios or when you need to direct user attention to the component.

    Examples
    // Focus the numeric textbox
    await numericTextBox.FocusAsync();

    FocusHandler(FocusEventArgs)

    Handles the focus event when the numeric textbox receives focus.

    Declaration
    protected override Task FocusHandler(FocusEventArgs args)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Web.FocusEventArgs args

    The focus event arguments containing event details.

    Returns
    Type Description
    System.Threading.Tasks.Task

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

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FocusHandler(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
    Remarks

    This method is called when the input element receives focus. It triggers client-side focus handling only if the component is enabled, not readonly, and the focus handler hasn't been triggered yet. The focus handler manages input formatting and user interaction states.

    FocusOutAsync()

    Removes the focus from the NumericTextBox component, if the component is in focus state.

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

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

    Remarks

    This method programmatically removes focus from the SfNumericTextBox<TValue> component. If the component is currently focused, it will lose focus and any pending input will be processed. This method is useful for form validation scenarios or when you need to blur the component programmatically.

    Examples
    // Remove focus from the numeric textbox
    await numericTextBox.FocusOutAsync();

    FocusOutHandler(FocusEventArgs)

    Handles the blur event when the numeric textbox loses focus.

    Declaration
    protected override Task FocusOutHandler(FocusEventArgs args)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Web.FocusEventArgs args

    The focus event arguments containing event details.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous blur handling operation.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FocusOutHandler(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
    Remarks

    This method is called when the input element loses focus and performs the following operations:

    • Triggers the Blur event if subscribed
    • Validates and formats the current input value
    • Handles device-specific behavior for mobile platforms
    • Updates float label sizing
    • Parses and converts input text to appropriate numeric types
    The method prevents recursive calls and ensures proper value conversion based on the data type (double or decimal).

    FormatValue(String)

    Converts a string input value to the appropriate numeric type based on the current component configuration.

    Declaration
    protected override TValue FormatValue(string genericValue)
    Parameters
    Type Name Description
    System.String genericValue

    The string value to be converted to the numeric type.

    Returns
    Type Description
    TValue

    The converted numeric value of type TValue, or default value if conversion fails.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FormatValue(System.String)
    Remarks

    This method handles culture-specific number parsing, decimal separator validation, and supports both double and decimal numeric types. It also manages formatting for focused input states and validates number formats.

    Exceptions
    Type Condition
    System.Exception

    Logs any unexpected errors that occur during value conversion to the console.

    FormatValueAsString(TValue)

    Formats the specified numeric value as a string representation based on the current formatting settings.

    Declaration
    protected override string FormatValueAsString(TValue formatValue)
    Parameters
    Type Name Description
    TValue formatValue

    The numeric value to be formatted.

    Returns
    Type Description
    System.String

    A string representation of the formatted value, or null if an error occurs.

    Overrides
    Syncfusion.Blazor.Inputs.SfInputTextBase<TValue>.FormatValueAsString(TValue)
    Remarks

    This method applies culture-specific formatting, handles exponential notation, manages decimal separators, and updates ARIA attributes for accessibility. The formatting behavior differs based on whether the input is focused or not.

    Exceptions
    Type Condition
    System.Exception

    Logs any unexpected errors that occur during formatting to the console.

    GetFormattedText()

    Gets the formatted text representation of the current value.

    Declaration
    public string GetFormattedText()
    Returns
    Type Description
    System.String

    A System.String containing the formatted text representation of the current value.

    Remarks

    This method returns the current value of the SfNumericTextBox<TValue> formatted according to the component's formatting settings. The formatting includes decimal places, currency symbols, percentage signs, and other culture-specific formatting as configured. This is useful when you need to display the formatted value in other parts of your application.

    Examples
    // Get the formatted text of the current value
    string formattedText = numericTextBox.GetFormattedText();

    GetPersistDataAsync()

    Gets the properties to be maintained in the persisted state.

    Declaration
    public Task<string> GetPersistDataAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    A System.Threading.Tasks.Task<> representing the asynchronous operation. The task result contains a System.String with the persisted data.

    Remarks

    This method retrieves the persisted state data for the SfNumericTextBox<TValue> component from the browser's local storage. The persisted data includes component properties that should be maintained across page refreshes or application restarts. This is useful for maintaining user preferences and component state in web applications.

    Examples
    // Get persisted data
    string persistedData = await numericTextBox.GetPersistDataAsync();

    IncrementAsync(TValue)

    Increments the NumericTextBox value with the specified step value.

    Declaration
    public Task IncrementAsync(TValue step)
    Parameters
    Type Name Description
    TValue step

    Specifies the value used to increment the NumericTextBox value. If not provided, the numeric value will be incremented based on the Step property value.

    Returns
    Type Description
    System.Threading.Tasks.Task

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

    Remarks

    This method increases the current value of the SfNumericTextBox<TValue> by the specified step amount. The operation is performed asynchronously and will trigger the change event after the value is updated. If the resulting value exceeds the maximum allowed value, it will be constrained to the maximum value.

    Examples
    // Increment by a custom step value
    await numericTextBox.IncrementAsync(10);
    
    // Increment by the default step value
    await numericTextBox.IncrementAsync(default(TValue));
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved