Skip to content

Inputs

NumberField

Bit.BlazorUI
NumberInput

A NumberField (also known as a number input or spin button) is a text field dedicated to numbers. It binds to any .NET numeric type - byte, sbyte, short, ushort, int, uint, long, ulong, float, double and decimal, plus every nullable variant - and never lets the value escape the range of that type. On top of plain typing it offers everything a professional numeric editor is expected to have: Min/Max bounds that either clamp the value or let it through for a validator to report, a custom Step with optional snapping to its grid, rounding precision, .NET number formatting that never gets in the way of editing, increment/decrement buttons in three layouts with press-and-hold continuous spinning that visibly go inert once a bound is reached, a clear button, prefixes, suffixes, icons and a description, the complete ARIA spinbutton keyboard set (Up/Down arrows, PageUp/PageDown, Home/End and Escape), Shift+mouse-wheel spinning, non-Latin (Persian/Arabic) digit input, immediate or on-commit value updates with debouncing and throttling, a public API for driving it from the outside, accent/background/border theming with underlined and borderless variants, RTL support, and first-class EditForm and data annotations integration.

Usage

Every example is live. Open its code to see exactly what produced the component running underneath.

Basic

The essential configurations of the BitNumberField: a plain field, a disabled field carrying a default value, a placeholder that shows before any value is entered, and a required field. The TValue type parameter selects the numeric type of the field (it is inferred automatically when a value is bound); with a nullable type the field can also be genuinely empty, which is what you want whenever "no value yet" is different from zero. By default focusing the field selects its whole text for a quick overwrite; NoSelectOnFocus disables that. The value is committed when the field loses focus or on Enter, and it is parsed with the invariant culture, tolerating whitespace between digit groups so that a number pasted from a spreadsheet or a web page still lands correctly. Anything that is not a number is rejected and reported through the standard validation channel (see the Validation section), rather than silently discarded. The field is rendered as an ARIA spinbutton and supports the full keyboard set of that pattern out of the box: Up/Down arrows step by the Step, PageUp/PageDown by a larger jump, and Home/End go to the Min/Max.





Label

The label of the BitNumberField can be positioned on any side of the input using the LabelPosition parameter, and can be fully customized (with any markup or components) using the LabelTemplate.

Label position:








LabelTemplate:

Description

The Description parameter renders a hint under the field - the accepted range, the unit, the reason the value matters - which is where a user looks before typing rather than after being told they got it wrong. It is not merely decorative: the input references it through aria-describedby, so a screen reader announces it together with the field and its label, and the hint reaches everybody rather than only the people who can see it. Use DescriptionTemplate when the hint needs markup or components of its own. AriaDescription is the complementary parameter - it adds an explanation for assistive technologies only, rendered into a visually hidden element - and the two can be combined, the input then referencing both in reading order.

Between 1 and 99 items per order.

kg
Rounded to one decimal place.

Anything above 50% needs a manager's approval.

The hint wraps onto a line of its own.

Mode & Icons

The Mode parameter decides how the increment/decrement buttons render: Compact stacks them at the end of the input, Inline puts them side by side at the end, and Spread puts one on each side with the value centered between them - the classic quantity picker. When Mode is left unset no buttons render at all, and the value is changed by typing, by the arrow keys or by the wheel. Holding a button down spins the value continuously (see the Step section for the timing parameters), and clicking one keeps the caret in the input, so the keyboard can take over from where the mouse left off. The buttons are decorated with IncrementIconName and DecrementIconName, and given hover tooltips with IncrementTitle and DecrementTitle. A separate IconName renders a decorative icon inside the field itself - give it an IconAriaLabel when it carries meaning, otherwise it is hidden from screen readers.

Button modes:






Component's Icon:




Increment & Decrement Icons and titles:



Appearance

Three parameters adjust the frame the field is drawn in, without touching anything it does. Underlined replaces the full border with a single bottom rule (the focus indicator follows suit and becomes a thicker rule rather than a ring), which suits dense forms and inline editing. NoBorder removes the border altogether - the right choice inside a surface that already provides one, such as a toolbar, a table cell or a card. FullWidth stretches the field to fill its container, which matters when it sits inside a flex or grid layout that would otherwise size it to its content.




ShowClearButton

Enabling ShowClearButton renders a clear (X) button inside the field whenever it is showing something, resetting the value to null with a single click. It follows what is actually in the input rather than just the bound value, so it also appears for text that failed to parse and needs wiping, and it disappears again as soon as the field is empty - including when the value is taken away from the outside. It is most useful with nullable value types, since only those can genuinely hold "no value". The button stays out of the tab order, keeping the input the single tab stop; Escape is the keyboard equivalent of clicking it. Its icon comes from ClearButtonIconName (or ClearButtonIcon for an external icon set) and its accessible name from ClearButtonAriaLabel. It is never rendered on a read-only field.



cleared: 0 time(s)

NumberFormat

The NumberFormat parameter formats the displayed value using standard or custom .NET numeric format strings, such as N0 (thousands grouping), C0 (currency), or a custom mask like 000000 (zero padding). The formatting is a display concern only: the bound value always stays a plain number, and while the field is being edited the plain number is what you see, so you never have to type around a currency symbol, a grouping separator or a run of padding zeros. The formatted rendering comes back as soon as the field loses focus. Typing a formatted number is accepted too - the separators and symbols of the current culture are stripped before parsing, including the parentheses that accounting formats use for negative amounts. Note that value-scaling formats such as the percent P format (which multiplies the displayed number by 100) are not suitable, since the scaled text cannot be parsed back into the same value.




Prefix & Suffix

Static text can be rendered before and after the input using the Prefix and Suffix parameters, which is how a unit ("km", "%") or a currency symbol is attached to a field without becoming part of what the user has to type: these adornments are visual only, never part of the bound value and never part of what gets parsed. That also means a screen reader announcing the value will not mention them, so keep the Label (or a Description) carrying the unit as well. When plain text is not enough - an icon, a button, a currency picker - PrefixTemplate and SuffixTemplate replace the adornment with arbitrary markup, in which case the surrounding container and its styling are yours to provide too.

Distance:

km

Distance:
km

Distance:
km

Distance:
km



PrefixTemplate & SuffixTemplate:

USD

Binding

The value can be bound one-way (the field only reflects the source and its edits are discarded on the next render) or two-way using @bind-Value, where edits flow back into the bound field immediately upon commit. There is also an uncontrolled mode: give the field a DefaultValue to start from and listen to OnChange, and the component keeps the value itself instead of requiring a backing field - handy for one-off fields inside a form that is read on submit.



last OnChange value: []

Min & Max

The Min and Max parameters bound the value of the field: any value entered or spun outside the range gets clamped to the nearest bound. When they are not provided, the natural range of the underlying numeric type applies (so spinning can never overflow the type). When an explicit bound is provided, the Home and End keys jump the value straight to the minimum and maximum, following the ARIA spinbutton pattern, and the bounds are announced through aria-valuemin/aria-valuemax. Once the value lands on a bound, the button that would step past it stops looking operable and is marked aria-disabled, so the ceiling is visible rather than merely felt - it deliberately keeps its place in the tab order, since in HideInput mode it may well be the element holding the focus. The bounds only apply to what the field itself does with the value: see NoClamp for keeping a typed out-of-range value so a validator can report it, and OnMinReached/OnMaxReached for reacting when a bound is hit.

value: [0]

value: [0]

value: [0]

Step

The Step parameter sets the amount added or removed on each spin, whether it comes from the increment/decrement buttons, the Up/Down arrow keys, or the mouse wheel (while holding Shift). A fractional step such as 0.1 also implies the rounding precision of typed values, unless an explicit Precision is provided. The PageUp and PageDown keys jump by a larger amount: the PageStep parameter when provided, or 10 times the Step otherwise. Combined with Min and Max, stepping stops exactly at the bounds. Stepping always applies to the value currently visible in the input, so typing a number and immediately pressing an arrow key steps from the newly typed value. Holding an increment/decrement button down spins the value continuously; the ContinuousSpinDelay and ContinuousSpinInterval parameters control how soon the continuous spin starts and how fast it runs.

value: [0]

value: [0]

value: [0]

value: [0]

value: [0]

Precision

The Precision parameter specifies how many decimal places the value is rounded to whenever it changes. By default no rounding happens (or, if a fractional Step is set, its number of decimals is used). A negative precision rounds to a power of ten, e.g. -2 rounds to the nearest hundred.


value: [0]

HideInput

Enabling HideInput hides the text input element while keeping the increment/decrement buttons functional, turning the component into a pure stepper control - a quantity picker, for instance. The current value can be surfaced elsewhere, like the label below. Since there is no focusable input left, the buttons take over as the keyboard entry point: they join the tab order and respond to Enter and Space, so the control stays fully operable without a mouse. A hidden input is invisible to assistive technologies as well as to the eye, so the value is additionally published through a visually hidden polite live region - a screen reader user pressing the buttons hears what the value became, exactly as they would from the spinbutton input. The hidden input still carries the value, so the field keeps posting with a plain HTML form. Pair it with a Mode, otherwise nothing is left to interact with.

Hidden input:

0

Mouse Wheel

The value can be changed by scrolling the mouse wheel over the field, under two deliberate conditions that keep the interaction from ever firing by accident: the Shift key must be held down (so plain page scrolling is never captured), and the field must be focused (so merely scrolling past a hovered field never silently rewrites data). By default, scrolling up increments the value; enabling InvertMouseWheel reverses that direction, and NoMouseWheel turns the wheel interaction off altogether while the buttons and the keyboard keep working. The wheel is a spin like any other: it steps by the Step, stops at the Min/Max, and reports through OnIncrement/OnDecrement, so a consumer never has to special-case the input device the change came from.



Immediate

By default the value is committed when the input loses focus (or on Enter). Enabling Immediate commits on every keystroke (the oninput event) instead. The DebounceTime parameter delays the commit until typing pauses for the given milliseconds, while ThrottleTime rate-limits commits to at most one per interval. While typing in Immediate mode the text you typed stays exactly as typed for as long as it still represents the committed value, so an in-progress number like 1. or 1.50 survives long enough to be finished; the canonical value takes over again as soon as the field loses focus, or immediately if clamping or rounding had to correct what was typed. Combining Immediate with a NumberFormat is best avoided for fractional values: every keystroke is a commit, and each commit re-renders the number from the value, which drops a trailing decimal point before it can be completed.

Value: []

Value: []

Value: []

Value: []

ReadOnly

The ReadOnly parameter makes the whole field read-only: typing, the spin buttons, the arrow keys and the mouse wheel all stop changing the value, but the field remains focusable and its value stays selectable and copyable. The spin buttons are disabled and the clear button is not rendered at all, so nothing in the field looks operable while it is not. The IsInputReadOnly parameter only blocks typing in the input itself, while the value can still be changed using the spin buttons, the arrow keys and the mouse wheel, making the field behave like a stepper with a protected text box - useful when the value must land on the exact grid the stepping produces.


Events

The BitNumberField exposes rich events: OnIncrement and OnDecrement fire when the value is spun (buttons, arrow keys, PageUp/PageDown or the mouse wheel) and receive the new value, OnChange fires whenever the committed value changes, and OnClear fires when the value is cleared using the clear button. OnMinReached and OnMaxReached report the moment a step lands the value on an explicit Min or Max - once per approach, not on every further attempt to pass it - which is the hook for explaining why the value stopped moving instead of leaving the user to guess. The raw input events are surfaced as well: OnKeyDown and OnKeyUp report every key, including the ones the field consumes itself as value commands, OnEnter singles out the Enter key and is raised after the typed text has been committed (so the bound value it sees is the one just entered, which is what makes it usable as a "submit this row" gesture), and OnClick reports clicks on the input. Focus is covered by OnFocus, OnFocusIn, OnFocusOut and OnBlur.

OnIncrement Counter: 0
OnDecrement Counter: 0

OnChange Counter: 0

OnClear Counter: 0

[]

[]

Last key down: []
OnKeyUp Counter: 0
OnClick Counter: 0

Public API

Captured with @ref, the component exposes the same operations its own controls perform, so an external control - a slider, a keypad, a barcode scanner, a hardware button - can drive the field without reimplementing its arithmetic. IncrementAsync and DecrementAsync step by the Step with the bounds, the snapping, the rounding and the OnIncrement/OnDecrement callbacks all applied, and do nothing once the value sits on the bound they would move towards. ClearAsync wipes whatever the field is showing and raises OnClear, without requiring the clear button to be enabled. All three respect the disabled and read-only states, and all three are safe to call from a background thread. FocusAsync (inherited from the input base) moves the caret into the field, and InputElement exposes the underlying element reference for anything else.

value: [4]

NormalizeDigits

Enables culture-agnostic normalization of non-Latin decimal digits (e.g. Persian "۱۲۳" or Arabic "١٢٣") and the Arabic decimal separator (٫) to their Latin equivalents before parsing. This makes the field accept numbers typed from the various Persian/Arabic keyboard layouts that emit different Unicode code points. The same normalization also applies to the Min, Max and Step parameters, so constraints like Min="۱۰" work consistently. The typed digits stay visible in the field as long as they represent the exact bound value.

Value:

Value:

Value:

For full control, provide a custom DigitsNormalizer function. It receives the raw input string and returns the normalized string before parsing, taking precedence over NormalizeDigits. The example below normalizes non-Latin digits and also strips spaces and thousand separators (both Latin "," and Persian "٬").

Value:

Validation

The BitNumberField integrates with Blazor's EditForm and data annotations out of the box: validation messages show up for out-of-range or missing values, the field gets the invalid styling, and the aria-invalid attribute is rendered automatically for assistive technologies. Text that is not a number at all is reported through the same channel instead of being silently dropped: the rejected text stays in the input so the user can fix it, and the message is taken from ParsingErrorMessage, whose {0} placeholder is filled with the DisplayName (or the bound field name). Setting NoValidate detaches the field from the EditContext entirely, which is what you want for a field that is a UI control rather than part of the edited model.



Numeric Types

The TValue type parameter of the BitNumberField accepts every .NET numeric type: byte, sbyte, short, ushort, int, uint, long, ulong, float, double and decimal, plus their nullable variants. Spinning safely clamps at the bounds of the underlying type, so a byte can never overflow past 255 and an int never wraps around at its maximum, and the arithmetic is carried out in a type wide enough that no intermediate step can overflow either - a ulong keeps working past long.MaxValue and a decimal keeps its full precision. The type also picks the mobile keyboard: the fractional types (float, double, decimal) get the decimal keypad and the integral ones the numeric keypad. Neither keypad offers a minus sign on every platform, so a field that must accept negative values on touch devices should ask for the full keyboard with InputMode="BitInputMode.Text".

value: [5]

value: [1000000000000]

value: [1.5]

value: [0.05]

value: [-5]

SnapToStep

Enabling SnapToStep snaps every committed value to the nearest multiple of the Step, so typed values land on the same grid that the increment/decrement stepping produces. The grid is anchored at the Min when one is provided (with Min=2 and Step=3 the reachable values are 2, 5, 8, ...), otherwise at zero. It also works with fractional steps, snapping typed decimals to the nearest fraction (e.g. 0.3 becomes 0.25 with a 0.25 step). Without SnapToStep, typed values are kept as-is, aside from min/max clamping and precision rounding. Bear in mind that a Max which is not itself on the grid is unreachable - with Step=3 and Max=10 the highest reachable value is 9 - so the field simply stops there, and a held button ends its press rather than spinning on a value that no longer moves.

value: [0]

value: [2]

value: [0]

NoClamp

By default a typed value outside of the Min/Max range is silently corrected to the nearest bound. That is the right behavior for a stepper, but it hides the mistake when the range is a business rule the user should be told about. Enabling NoClamp lets the out-of-range number through so that the model receives it and a validator (e.g. a [Range] data annotation) can report it, exactly as a plain text input would. The bounds keep their other roles: stepping with the buttons, the arrow keys and the wheel still stops at them, the Home/End keys still jump to them, and they are still announced through aria-valuemin/aria-valuemax.

value: [0]

value: [0]

Accessibility

The input is exposed as an ARIA spinbutton and keeps its aria-valuenow, aria-valuemin, aria-valuemax and aria-valuetext attributes in sync with the value and the configured bounds, so screen readers announce the number, the range and (when the visible text differs from the raw number, e.g. with a NumberFormat or non-Latin digits) how it is read out. aria-valuemin/aria-valuemax only appear for an explicit Min/Max, since announcing the underlying type's extremes would be noise rather than information, and aria-valuenow is left off entirely while the field is empty, which is how ARIA expresses "no value yet". AriaValueText overrides the reading with a human phrase, AriaValueNow overrides the announced number (only meaningful for a controlled field), AriaDescription adds a longer explanation through a visually hidden element, and the visible Description is referenced the same way - both through aria-describedby. The increment, decrement and clear buttons are icon-only, so they always carry an accessible name; it defaults to a sensible English phrase and can be localized using IncrementAriaLabel, DecrementAriaLabel and ClearButtonAriaLabel. Once the value reaches a bound, the button that would step past it is marked aria-disabled rather than being given the disabled attribute, so it is announced as unavailable without vanishing from the accessibility tree or dropping the focus it may be holding. Those buttons stay out of the tab order, keeping the input the single tab stop that handles the whole spinbutton keyboard set - except in HideInput mode, where they become the only control left and therefore turn into keyboard-reachable, Enter/Space-operable buttons, with the value published through a visually hidden live region since the hidden input cannot announce it. AriaSetSize and AriaPositionInSet place the field within a larger group of related fields. Validation failures render aria-invalid automatically, and the focus indicator follows the Accent color (turning to the error color while the field is invalid) so it stays visible against any surface.

Use the up and down arrow keys to adjust the volume between 0 and 10.


Background

The Background parameter picks the fill of the field from the theme's background color kinds (Primary by default), so it can be tuned to the surface it sits on instead of being hard-coded. Transparent is the one to reach for when the field has to disappear into a colored panel, a toolbar or a table cell - pair it with NoBorder or Underlined for a fully seamless look.




Border

The Border parameter picks the color of the field's border from the theme's border color kinds (Primary by default). Transparent keeps the border's one-pixel gutter - so the field neither shifts nor resizes - while making it invisible, which is the difference between it and NoBorder.




Accent

The Accent parameter sets the general color of the field: it drives the focus indicator and the tint the icon, the prefix and the suffix take on while the field is focused (Primary by default). It is what lets a number field carry the meaning of what it is editing - a Success accent on a healthy figure, a Warning or Error accent on one that needs attention - without overriding any style by hand. Note that a genuine validation failure still paints the field with the error color regardless of the accent, so the two never contradict each other. Click into the fields below to see each accent.

$

$

$

$

$

$

$

$

$

$

$

$

$

$

$

$

$

External Icons

Use icons from external libraries like FontAwesome, Material Icons, and Bootstrap Icons with the Icon, IncrementIcon, and DecrementIcon parameters.


Component Icon (FontAwesome):







Increment & Decrement Icons (FontAwesome):





Component Icon (Bootstrap):





Increment & Decrement Icons (Bootstrap):

Style & Class

The appearance can be customized at every level: the root Style and Class parameters, plus the Styles and Classes parameters that target each internal part of the component (root, label, description, input container, input, buttons, icons, prefix, suffix, etc.), including the focus state through the Focused member - which is also the natural place to declare a CSS variable the other parts can then read, as the Styles example below does. Reach for these only where Accent, Background, Border, Underlined and NoBorder cannot express what you need: those keep the field in step with the theme, while a hand-written style does not.


Component's Style & Class:





Styles & Classes:

The description is styleable too.

RTL

The BitNumberField fully supports right-to-left (RTL) rendering, either using its Dir parameter or a cascading BitDir.Rtl value: the label, the buttons, the required indicator and the input alignment all flip accordingly.




API

Every parameter, public member, sub-class and enum this component exposes.

BitNumberField parameters

Name Type Default value Description
Accent BitColor? null The general color of the number field, used for its focus indicator and for the icon, prefix and suffix while the field is focused (Primary by default).
AriaDescription string? null Detailed description of the input for the benefit of screen readers. It is rendered into a visually hidden element that the input references through its aria-describedby attribute.
AriaPositionInSet int? null The position in the parent set (if in a set).
AriaSetSize int? null The total size of the parent set (if in a set).
AriaValueNow TValue? null Sets the control's aria-valuenow. Providing this only makes sense when using as a controlled component.
AriaValueText string? null Sets the control's aria-valuetext.
Background BitColorKind? null The color kind of the number field background (Primary by default).
Border BitColorKind? null The color kind of the number field border (Primary by default).
Classes BitNumberFieldClassStyles? null Custom CSS classes for different parts of the BitNumberField.
ContinuousSpinDelay int 400 The delay in milliseconds before the value starts changing continuously while an increment/decrement button is held down.
ContinuousSpinInterval int 75 The interval in milliseconds between two consecutive value changes while an increment/decrement button is held down.
DecrementAriaLabel string? null Accessible label text for the decrement button (for screen reader users).
DecrementIcon BitIconInfo? null Gets or sets the icon to display on the decrement button using custom CSS classes for external icon libraries. Takes precedence over DecrementIconName when both are set.
DecrementIconName string? null Gets or sets the name of the icon for the decrement button from the built-in Fluent UI icons. For external icon libraries, use DecrementIcon instead.
DecrementTitle string? null The title to show when the mouse is placed on the decrement button.
Description string? null A hint rendered under the field, describing what is expected of it (e.g. the accepted range or the unit). Unlike AriaDescription it is visible, and the input references it through its aria-describedby attribute so it is announced along with the field.
DescriptionTemplate RenderFragment? null A custom template rendered in place of the Description, referenced by the input through its aria-describedby attribute just the same.
DigitsNormalizer Func<string?, string?>? null A custom function to normalize the raw input string before it gets parsed into the value. When provided, it takes precedence over NormalizeDigits and lets the developer plug in their own culture-specific or domain-specific transformation.
FullWidth bool false Stretches the number field to the full width of its container. By default the field only takes the width it needs, which keeps a stepper from spanning a whole form row.
HideInput bool false Hides the text input element while keeping the increment/decrement buttons functional, turning the component into a stepper-only control.
IconAriaLabel string? null The aria label of the icon for the benefit of screen readers.
Icon BitIconInfo? null Gets or sets the icon to display alongside the number field using custom CSS classes for external icon libraries. Takes precedence over IconName when both are set.
IconName string? null Gets or sets the name of the icon to display alongside the number field from the built-in Fluent UI icons. For external icon libraries, use Icon instead.
IncrementAriaLabel string? null Accessible label text for the increment button (for screen reader users).
IncrementIcon BitIconInfo? null Gets or sets the icon to display on the increment button using custom CSS classes for external icon libraries. Takes precedence over IncrementIconName when both are set.
IncrementIconName string? null Gets or sets the name of the icon for the increment button from the built-in Fluent UI icons. For external icon libraries, use IncrementIcon instead.
IncrementTitle string? null The title to show when the mouse is placed on the increment button.
InputMode BitInputMode? null Overrides the virtual keyboard the browser shows for the input. By default it is Numeric for the integral types and Decimal for the fractional ones (float, double and decimal). Since neither of those keypads offers a minus sign on every platform, a field that has to accept negative values on touch devices is better served by Text, which brings up the full keyboard.
InvertMouseWheel bool false Reverses the direction of the value change when the user spins the value using the mouse wheel (the wheel only changes the value while the Shift key is held down, to keep normal page scrolling intact).
IsInputReadOnly bool false Makes only the text input part read-only, preventing typing, while the value can still be changed using the increment/decrement buttons, the arrow keys and the mouse wheel (unlike ReadOnly, which blocks all of them).
LabelPosition BitLabelPosition? null The position of the label in regards to the field (Top by default).
Label string? null Descriptive label for the number field, rendered next to it (per LabelPosition) and read by screen readers.
LabelTemplate RenderFragment? null Shows the custom Label for number field. If you don't call default label, ensure that you give your custom label an id and that you set the input's aria-labelledby prop to that id.
Min string? null The minimum value of the number field. Values below it get clamped to it, both when typed and when spinning. It is a string to support any numeric type of the field; an unparsable value falls back to the type's MinValue.
Max string? null The maximum value of the number field. Values above it get clamped to it, both when typed and when spinning. It is a string to support any numeric type of the field; an unparsable value falls back to the type's MaxValue.
Mode BitSpinButtonMode? null Determines how the increment/decrement buttons render: Compact (stacked at the end of the input), Inline (side by side at the end) or Spread (one on each side). When null (default), no buttons render, while the value can still be changed using the arrow keys and the mouse wheel.
NoBorder bool false Removes the border of the number field, which is what you want when it sits inside a surface that already provides one (a toolbar, a table cell or a card).
NoClamp bool false Keeps values typed outside of the Min/Max range intact instead of clamping them to the nearest bound, so that a form validation (e.g. a [Range] data annotation) can report the out-of-range value to the user instead of it being silently corrected. Stepping with the increment/decrement buttons, the arrow keys or the mouse wheel still stays inside the range, and the Home/End keys still jump to the bounds.
NoMouseWheel bool false Disables changing the value using the mouse wheel entirely (by default the value changes when the wheel is scrolled over the focused field while the Shift key is held down).
NoSelectOnFocus bool false Disables the automatic select-all of the input's text when the field receives focus.
NormalizeDigits bool false Normalizes non-Latin (e.g. Persian "۱۲۳" or Arabic "١٢٣") decimal digits to their Latin (0-9) equivalents before parsing. This is culture-agnostic and works for any Unicode decimal digit system.
NumberFormat string? null The format of the number in the number field, using the standard or custom .NET numeric format strings (e.g. "N0", "C0" or "000000"). The formatting is applied whenever the value is committed, while the bound value stays a plain number. Value-scaling formats (like the percent "P" format) are not suitable, since the scaled display cannot be parsed back into the same value.
OnBlur EventCallback<FocusEventArgs> Callback for when the control loses focus.
OnClear EventCallback Callback executed when the user clears the number field by clicking the clear button.
OnClick EventCallback<MouseEventArgs> Callback for when the input is clicked.
OnDecrement EventCallback<TValue> Callback for when the decrement button or down arrow key is pressed.
OnEnter EventCallback<KeyboardEventArgs> Callback for when the Enter key is pressed on the input. It is invoked after the typed text has been committed, so the bound value it observes is already the one the user just entered.
OnFocus EventCallback<FocusEventArgs> Callback for when focus moves into the input.
OnFocusIn EventCallback<FocusEventArgs> Callback for when focus moves into the input.
OnFocusOut EventCallback<FocusEventArgs> Callback for when focus moves out of the input.
OnIncrement EventCallback<TValue> Callback for when the increment button or up arrow key is pressed.
OnKeyDown EventCallback<KeyboardEventArgs> Callback for when a key is pressed down on the input. It is invoked for every key, including the ones the field handles itself (the arrow keys, PageUp/PageDown, Home/End and Escape).
OnKeyUp EventCallback<KeyboardEventArgs> Callback for when a key is released on the input.
OnMaxReached EventCallback<TValue> Callback for when a step lands the value on (or beyond) the explicit Max, letting the consumer react to the ceiling being hit. It only fires for an explicit Max, and only on the step that reaches it.
OnMinReached EventCallback<TValue> Callback for when a step lands the value on (or beyond) the explicit Min. It only fires for an explicit Min, and only on the step that reaches it.
PageStep string? null The amount by which the value changes when the user presses the PageUp/PageDown keys, providing a larger jump than the regular Step. It is a string to support any numeric type of the field; when not provided (or unparsable), PageUp/PageDown change the value by 10 times the Step.
ParsingErrorMessage string The {0} field is not valid. The message format used for invalid values entered in the input.
Placeholder string? null Input placeholder text.
Precision int? null How many decimal places the value should be rounded to. When not provided, the precision is derived from the fractional digits of the Step parameter (if any); otherwise no rounding is applied. A negative value rounds to a power of ten (e.g. -2 rounds to the nearest hundred).
Prefix string? null Prefix displayed before the numeric field contents. This is not included in the value. Ensure a descriptive label is present to assist screen readers, as the value does not include the prefix.
PrefixTemplate RenderFragment? null Shows the custom prefix for numeric field.
ClearButtonIcon BitIconInfo? null Gets or sets the icon to display on the clear button using custom CSS classes for external icon libraries. Takes precedence over ClearButtonIconName when both are set.
ClearButtonIconName string? null Gets or sets the name of the icon for the clear button from the built-in Fluent UI icons. For external icon libraries, use ClearButtonIcon instead.
ClearButtonAriaLabel string? null Accessible label text for the clear button (for screen reader users), useful for localization.
ShowClearButton bool false Whether to show the clear button whenever the field is showing something, resetting the value to null with a single click (most useful with nullable value types). "Showing something" covers a string the user typed that failed to parse as well as a real value, so the button is also there to wipe an entry that has to be corrected. It is not rendered while the field is read-only or empty. It stays out of the tab order (like the increment/decrement buttons), the Escape key being the keyboard equivalent of clicking it.
SnapToStep bool false Snaps the committed value to the nearest multiple of the Step (anchored at the Min when one is provided), so typed values align to the same grid that the increment/decrement stepping produces. Without it, typed values are kept as-is (aside from min/max clamping and precision rounding).
Step string? null The difference between two adjacent values of the number field, applied when spinning the value using the increment/decrement buttons, the Up/Down arrow keys or the mouse wheel. A fractional step (e.g. "0.01") also implies the rounding precision of the field, unless an explicit Precision is provided. It is a string to support any numeric type of the field; an unparsable value falls back to 1.
Styles BitNumberFieldClassStyles? null Custom CSS styles for different parts of the BitNumberField.
Suffix string? null Suffix displayed after the numeric field contents. This is not included in the value. Ensure a descriptive label is present to assist screen readers, as the value does not include the suffix.
SuffixTemplate RenderFragment? null Shows the custom suffix for numeric field.
Title string? null A more descriptive title for the control, visible on its tooltip.
Underlined bool false Renders the number field with a single bottom rule instead of a full border, the classic "underlined" input variant.

BitNumberField public members

Name Type Default value Description
ClearAsync Task Clears whatever the field is showing - a value or a string that failed to parse - and raises OnClear, exactly as the clear button and the Escape key do (without requiring ShowClearButton, since there is no button involved). It does nothing while the field is disabled or read-only.
DecrementAsync Task Decrements the value by the Step, the mirror image of IncrementAsync.
FocusAsync ValueTask Gives focus to the input element of the BitNumberField.
IncrementAsync Task Increments the value by the Step, exactly as the increment button does - bounds, snapping, rounding and the OnIncrement/OnMaxReached callbacks all included. It does nothing while the field is disabled or read-only, or when the value already sits at the Max.
InputElement ElementReference The ElementReference to the input element of the BitNumberField.

BitTextInputBase parameters

Name Type Default value Description
AutoComplete string? null Specifies the value of the autocomplete attribute of the input component.
AutoFocus bool false Determines if the text input is auto focused on first render.
DebounceTime int 0 The debounce time in milliseconds.
Immediate bool false Change the content of the input field when the user write text (based on 'oninput' HTML event).
ThrottleTime int 0 The throttle time in milliseconds.

BitInputBase parameters

Name Type Default value Description
DefaultValue TValue? null The default value of the input to be used in uncontrolled mode (i.e. when the Value is not bound), typically used alongside the OnChange callback.
DisplayName string? null Gets or sets the display name for this field.
InputHtmlAttributes IReadOnlyDictionary<string, object>? null Gets or sets a collection of additional attributes that will be applied to the created element.
Name string? null Gets or sets the name of the element. Allows access by name from the associated form.
NoValidate bool false Disables the validation of the input.
OnChange EventCallback<TValue?> Callback for when the input value changes.
ReadOnly bool false Makes the input read-only.
Required bool false Makes the input required.
Value TValue? null Gets or sets the value of the input. This should be used with two-way binding.

BitInputBase public members

Name Type Default value Description
InputElement ElementReference The ElementReference of the input element.
FocusAsync() () => ValueTask Gives focus to the input element.
FocusAsync(bool preventScroll) (bool preventScroll) => ValueTask Gives focus to the input element.

BitComponentBase parameters

Name Type Default value Description
AriaLabel string? null Gets or sets the accessible label for the component, used by assistive technologies.
Class string? null Gets or sets the CSS class name(s) to apply to the rendered element.
Dir BitDir? null Gets or sets the text directionality for the component's content.
ForceAnimation bool false Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested.
HtmlAttributes Dictionary<string, object> new Dictionary<string, object>() Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters.
Id string? null Gets or sets the unique identifier for the component's root element.
IsEnabled bool true Gets or sets a value indicating whether the component is enabled and can respond to user interaction.
Style string? null Gets or sets the CSS style string to apply to the rendered element.
TabIndex string? null Gets or sets the tab order index for the component when navigating with the keyboard.
Visibility BitVisibility BitVisibility.Visible Gets or sets the visibility state (visible, hidden, or collapsed) of the component.

BitComponentBase public members

Name Type Default value Description
UniqueId Guid Guid.NewGuid() Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed.
RootElement ElementReference Gets the reference to the root HTML element associated with this component.

BitIconInfo properties

Represents icon information for rendering icons in Bit BlazorUI components. Supports both built-in Fluent UI icons and custom/external icon libraries (e.g. FontAwesome, Bootstrap Icons). Use BitIconInfo.Css(string), BitIconInfo.Fa(string), or BitIconInfo.Bi(string) for external icons.

Name Type Default value Description
Name string? null Gets or sets the name of the icon. For external icons, this can be the full CSS class name if BaseClass and Prefix are empty.
BaseClass string? null Gets or sets the base CSS class for the icon. For built-in Fluent UI icons, this defaults to "bit-icon". For external icon libraries like FontAwesome, you might set this to "fa" or leave empty.
Prefix string? null Gets or sets the CSS class prefix used before the icon name. For built-in Fluent UI icons, this defaults to "bit-icon--". For external icon libraries, you might set this to "fa-" or leave empty.

BitNumberFieldClassStyles properties

Name Type Default value Description
ButtonsContainer string? null Custom CSS classes/styles for the number field's buttons (increment and decrement) container.
DecrementButton string? null Custom CSS classes/styles for the number field's decrement button.
DecrementIcon string? null Custom CSS classes/styles for the number field's decrement icon.
DecrementIconContainer string? null Custom CSS classes/styles for the number field's decrement icon container.
Description string? null Custom CSS classes/styles for the number field's description.
DescriptionContainer string? null Custom CSS classes/styles for the number field's description container.
IncrementButton string? null Custom CSS classes/styles for the number field's increment button.
IncrementIcon string? null Custom CSS classes/styles for the number field's increment icon.
IncrementIconContainer string? null Custom CSS classes/styles for the number field's increment icon container.
Label string? null Custom CSS classes/styles for the number field's label.
LabelContainer string? null Custom CSS classes/styles for the number field's label container.
Focused string? null Custom CSS classes/styles for the number field's focus state.
Icon string? null Custom CSS classes/styles for the number field's icon.
Input string? null Custom CSS classes/styles for the number field's input.
InputContainer string? null Custom CSS classes/styles for the container of label and input in the number field.
Root string? null Custom CSS classes/styles for the number field's root element.
ClearButton string? null Custom CSS classes/styles for the number field's clear button.
ClearButtonIcon string? null Custom CSS classes/styles for the number field's clear button icon.
PrefixContainer string? null Custom CSS classes/styles for the number field's prefix container.
Prefix string? null Custom CSS classes/styles for the number field's prefix.
SuffixContainer string? null Custom CSS classes/styles for the number field's suffix container.
Suffix string? null Custom CSS classes/styles for the number field's suffix.

BitLabelPosition enum

Name Value Description
Top 0 The label shows on the top of the spin button.
Start 1 The label shows on the start of the spin button.
End 2 The label shows on the end of the spin button.
Bottom 3 The label shows on the bottom of the spin button.

BitInputMode enum

Name Value Description
None 0 No virtual keyboard. For when the page implements its own keyboard input control.
Text 1 Standard input keyboard for the user's current locale.
Decimal 2 Fractional numeric input keyboard containing the digits and decimal separator for the user's locale.
Numeric 3 Numeric input keyboard, but only requires the digits 0–9.
Tel 4 A telephone keypad input, including the digits 0–9, the asterisk (*), and the pound (#) key.
Search 5 A virtual keyboard optimized for search input.
Email 6 A virtual keyboard optimized for entering email addresses.
Url 7 A keypad optimized for entering URLs.

BitSpinButtonMode enum

Name Value Description
Compact 0 Spinning buttons render as a compact stack at the end of the input.
Inline 1 Spinning buttons render inlined at the end of the input.
Spread 2 Spinning buttons render at the start and end of the input.

BitColor enum

Name Value Description
Primary 0 Primary general color.
Secondary 1 Secondary general color.
Tertiary 2 Tertiary general color.
Info 3 Info general color.
Success 4 Success general color.
Warning 5 Warning general color.
SevereWarning 6 SevereWarning general color.
Error 7 Error general color.
PrimaryBackground 8 Primary background color.
SecondaryBackground 9 Secondary background color.
TertiaryBackground 10 Tertiary background color.
PrimaryForeground 11 Primary foreground color.
SecondaryForeground 12 Secondary foreground color.
TertiaryForeground 13 Tertiary foreground color.
PrimaryBorder 14 Primary border color.
SecondaryBorder 15 Secondary border color.
TertiaryBorder 16 Tertiary border color.

BitColorKind enum

Name Value Description
Primary 0 Primary color kind.
Secondary 1 Secondary color kind.
Tertiary 2 Tertiary color kind.
Transparent 3 Transparent color kind.

BitVisibility enum

Name Value Description
Visible 0 The content of the component is visible.
Hidden 1 The content of the component is hidden, but the space it takes on the page remains (visibility:hidden).
Collapsed 2 The component is hidden (display:none).

BitDir enum

Name Value Description
Ltr 0 Ltr (left to right) is to be used for languages that are written from the left to the right (like English).
Rtl 1 Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic).
Auto 2 Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.