Number field
The number field component captures numeric input with built-in number validation. Use it to collect quantities, prices, or other numeric information.
The component supports optional stepper controls, min/max constraints, and step increments for guided numeric entry.
Supported targets
Supported targets
Anchor to PropertiesProperties
Configure the following properties on the NumberField component.
- Anchor to controlscontrolscontrols'auto' | 'stepper' | 'none''auto' | 'stepper' | 'none'Default: 'auto'Default: 'auto'
The type of controls displayed for the field:
'auto'- An automatic setting where the presence of controls depends on the surface and context. The system determines the most appropriate control type based on the usage scenario.'stepper'- Displays increment (+) and decrement (-) buttons for adjusting the numeric value. Whensteppercontrols are enabled, the field behavior is constrained: it accepts only integer values, always contains a value (never empty), and automatically validates againstminandmaxbounds. Thelabel,details,placeholder,error,required, andproperties aren't supported withsteppercontrols.'none'- A control type with no visible controls where users must input the value manually using the keyboard.
- Anchor to detailsdetailsdetailsstringstring
The additional text to provide context or guidance for the field. This text is displayed along with the field and its label to offer more information or instructions to the user. This will also be exposed to screen reader users.
- Anchor to disableddisableddisabledbooleanbooleanDefault: falseDefault: false
Whether the field is disabled, preventing user interaction. Use when the field is temporarily unavailable due to application state, permissions, or dependencies.
- Anchor to errorerrorerrorstringstring
An error message to indicate a problem to the user. The field will be given specific stylistic treatment to communicate issues that must be resolved immediately.
- Anchor to idididstringstring
A unique identifier for the element used for targeting with CSS, JavaScript, or accessibility features.
- Anchor to inputModeinputModeinputMode'decimal' | 'numeric''decimal' | 'numeric'Default: 'decimal'Default: 'decimal'
The virtual keyboard layout that the field displays for numeric input. This property isn't supported when using
steppercontrols.'decimal'- A keyboard layout that includes decimal point support for entering fractional numbers, prices, or measurements with decimal precision.'numeric'- A keyboard layout optimized for integer-only entry without decimal point support, ideal for quantities, counts, or whole number values.
- Anchor to labellabellabelstringstring
The content to use as the field label that describes the numeric information being requested.
- Anchor to maxmaxmaxnumbernumberDefault: InfinityDefault: Infinity
The highest decimal or integer value that the field accepts. When used with
steppercontrols, the value rounds down to the max number. Users can still input higher numbers by keyboard—validation should be implemented.- Anchor to minminminnumbernumberDefault: -InfinityDefault: -Infinity
The lowest decimal or integer value that the field accepts. When used with
steppercontrols, the value rounds up to the min number. Users can still input lower numbers by keyboard—validation should be implemented.- Anchor to placeholderplaceholderplaceholderstringstring
A short hint that provides guidance about the expected value of the field.
- Anchor to requiredrequiredrequiredbooleanbooleanDefault: false Required isn't supported when using Stepper controlsDefault: false Required isn't supported when using Stepper controls
Whether the field needs a value. This requirement adds semantic value to the field but doesn't cause an error to appear automatically. Use the
errorproperty to present validation errors.- Anchor to valuevaluevaluestringstring
The current numeric value entered in the field. An empty string means no value is entered.
Anchor to SlotsSlots
The number field component supports slots for additional content placement within the field. Learn more about using slots.
- Anchor to accessoryaccessoryaccessoryHTMLElementHTMLElement
The additional content to be displayed in the field. Commonly used to display clickable text or action elements. Only button and clickable components with text content only are supported in this slot. Use the
slot="accessory"attribute to place elements in this area.
Anchor to EventsEvents
The number field component provides event callbacks for handling user interactions. Learn more about handling events.
- Anchor to blurblurblur(event: CallbackEvent<"s-number-field">) => void(event: CallbackEvent<"s-number-field">) => void
Called when the element loses focus.
- Anchor to changechangechange(event: CallbackEvent<"s-number-field">) => void(event: CallbackEvent<"s-number-field">) => void
Called after editing completes, typically on blur.
- Anchor to focusfocusfocus(event: CallbackEvent<"s-number-field">) => void(event: CallbackEvent<"s-number-field">) => void
Called when the element receives focus.
- Anchor to inputinputinput(event: CallbackEvent<"s-number-field">) => void(event: CallbackEvent<"s-number-field">) => void
Called when the user makes any changes in the field.
CallbackEvent
Represents the event object passed to callback functions when interactive events occur. Contains metadata about the event, including the target element, event phase, and propagation behavior.
- bubbles
Whether the event bubbles up through the DOM tree.
boolean - cancelable
Whether the event can be canceled.
boolean - composed
Whether the event will trigger listeners outside of a shadow root.
boolean - currentTarget
The element that the event listener is attached to.
HTMLElementTagNameMap[T] - detail
Additional data associated with the event.
any - eventPhase
The current phase of the event flow.
number - target
The element that triggered the event.
HTMLElementTagNameMap[T] | null
Anchor to ExamplesExamples
Anchor to Capture numeric input with a number fieldCapture numeric input with a number field
Capture numeric input using a number field component. This example shows a basic number field with a label for collecting numeric values.Capture numeric input with a number field

Capture numeric input with a number field
Anchor to Add stepper controls and constraintsAdd stepper controls and constraints
Enable stepper controls with increment and decrement buttons and set min/max constraints to limit valid input ranges. This example demonstrates using the controls property with min and max values to create bounded numeric inputs with visual stepper controls, ideal for quantity selection or limited-range numeric entry.Add stepper controls and constraints
Anchor to Configure keyboard input modesConfigure keyboard input modes
Configure the keyboard layout by specifying inputMode for decimal or numeric entry. This example shows how to use the inputMode property to display appropriate mobile keyboards—numeric for integers or decimal for numbers with fractional parts—improving data entry speed and accuracy.Configure keyboard input modes
Anchor to Best practicesBest practices
- Choose appropriate controls: Use
stepperfor quantities or small adjustments. Usenonefor prices or large values where steppers are impractical. - Select the right input mode: Use
decimalfor prices and measurements. Usenumericfor quantities and counts. - Explain constraints in details: Use
detailsto clarify valid ranges or formatting, like "Enter a quantity between 1 and 999."