Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

NumberInput

Edit nullable numbers with bounds, steppers and locale-aware decimal or currency formatting.

Category
Forms and selection
Import
@neural-ui/core/number-input
Selector
neu-number-input
import { NeuNumberInputComponent } from '@neural-ui/core/number-input';

Usage

The model is number | null, never formatted text. formatOptions controls locale, decimal digits and optional currency. min/max bound accepted values; step controls the steppers. inputDetail distinguishes valid, incomplete and invalid editing text without replacing the committed model.

Examples

Interact with the example and open Code for its complete implementation.

Examples

Try and configure

Change the controls and try the live preview. Expand the application value or event to inspect its real data; the generated template stays with the configurator.

Try and configure

Live preview

Generated template: the options above. The Code tab contains the imports and state.

template.html
<neu-number-input
  [(value)]="number"
  [min]="0"
  [max]="100"
  [step]="1"
  layout="stacked"
  size="md"
  [formatOptions]="formatOptions"
  [floatingLabel]="true"
  [label]="'Quantity'"
/>

Signal Forms

Bind FormField once to the component; the field owns value and validation. The schema requires a non-empty value. Leave the control to mark it touched, then reset the field to clear both value and interaction state.

Signal Forms guide

Signal Forms

Valid: false

Value and events

Use [(value)] or [value] with (valueChange), not both. The model synchronizes application state; other Outputs communicate their documented events. touch reports leaving/visiting the control, not a new value.

Accessibility and keyboard

Associate label with the number field. Name both stepper buttons with incrementLabel/decrementLabel. ArrowUp/ArrowDown changes step; Home/End uses configured bounds. Explain invalid or incomplete text with a message rather than color alone.

Key
Action
Tab Moves through the editable field and its buttons.
ArrowUp / ArrowDown Increases or decreases by step.
Home / End Sets min or max when that bound is configured.
Enter Finishes editing the current text.

API

Inputs, models and Outputs come from the pinned Core contract. Click named types to open their definitions. This component has no public template slots.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
ariaDescribedBystring''[ariaDescribedBy]IDs of elements describing the control, separated by spaces.
ariaLabelstring''[ariaLabel]Accessible name when no visible label is available.
ariaLabelledBystring''[ariaLabelledBy]IDs of elements naming the native number input, separated by spaces.
decrementLabelstring'Decrease'[decrementLabel]Accessible name of the decrease button.
dirtybooleanfalse[dirty]Form state indicating that the user has changed the value.
disabledbooleanfalse[disabled]Prevents user interaction.
errorsreadonly ValidationError.WithOptionalFieldTree[][][errors]Validation errors supplied by the form or the application.
floatingLabelbooleanfalse[floatingLabel]Displays the label in the floating-label field style.
formatOptionsNeuNumberInputFormatOptionsDEFAULT_FORMATDerived default[formatOptions]Locale and decimal/currency formatting. Currency style requires a currency code.
hiddenbooleanfalse[hidden]Hides the control according to the form state.
incrementLabelstring'Increase'[incrementLabel]Accessible name of the increase button.
inputIdstringinject(NeuIdGenerator).getId('neu-number-input-')Derived default[inputId]Stable identifier of the native control; automatically generated when omitted.
invalidbooleanfalse[invalid]Displays the invalid state; it does not add a validation rule.
labelstring''[label]Visible label and accessible name of the control.
layoutNeuNumberInputLayout'stacked'[layout]Places steppers in stacked, horizontal or vertical arrangement.
maxnumber | undefinedundefined[max]Upper bound for stepper and keyboard commands. Typed values are preserved; add max validation to the form schema to validate them.
minnumber | undefinedundefined[min]Lower bound for stepper and keyboard commands. Typed values are preserved; add min validation to the form schema to validate them.
namestring''[name]Name associated with the native form control.
pendingbooleanfalse[pending]Form state indicating that asynchronous validation is pending.
readonlybooleanfalse[readonly]Keeps the control focusable and readable without accepting edits.
requiredbooleanfalse[required]Marks the field as required; use a form validator to enforce it.
size"sm" | "md" | "lg"'md'[size]Visual field size: sm, md or lg.
stepnumber1[step]Accepted increment between values.
touchedbooleanfalse[touched]Form state indicating that the control has been visited.

Models

A model supports [(property)]="signal" or the [property] and (propertyChange) pair. Choose one form, not both.

Name
Type
Default
Template binding
Description
valuenumber | nullnull[(value)]Committed number or null for an empty value; synchronized through valueChange.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
inputDetailNeuNumberInputDetail(inputDetail)="onInputDetail($event)"Editing detail: rawText, parsing state and committed numeric value. Does not replace valueChange.
touchvoid(touch)="onTouch($event)"Notifies the form that the control has been touched; not a value change.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

This component does not expose content projection or public customization templates.

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Load Core styles once. Use the public tokens below for local customization or a preset for application-wide changes. Keep labels, focus, selected options and disabled states readable in both light and dark themes.

Specific tokens

Token
Purpose
State / variant
Default / source
Fallback
--neu-number-input-btn-size Inherited theme value used by this component Field surface 2remRoot declarationNo token alias
--neu-number-input-height Inherited theme value used by this component Field surface 48pxRoot declarationNo token alias
--neu-number-input-stacked-min-width Inherited theme value used by this component Field surface 120pxRoot declarationNo token alias
--neu-number-input-width Inherited theme value used by this component Field surface 80pxRoot declarationNo token alias

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-border Normal control and cell borders Shared by other Core consumers; scope the override. rgba(15, 23, 42, 0.08)
--neu-focus-ring Normal keyboard-focus ring Shared by other Core consumers; scope the override. 0 0 0 var(--neu-focus-ring-width) rgba(0, 122, 255, 0.15)
--neu-primary Brand color for active controls and emphasis Shared by other Core consumers; scope the override. #007aff
--neu-radius Control corner radius Shared by other Core consumers; scope the override. 8px
--neu-surface Main field, header or control surface Shared by other Core consumers; scope the override. #ffffff
--neu-surface-2 Secondary surfaces and alternating rows Shared by other Core consumers; scope the override. #f1f5f9
--neu-text Main text and inherited icon color Shared by other Core consumers; scope the override. #0f172a
--neu-text-muted Secondary labels and supporting content Shared by other Core consumers; scope the override. #475569