Page History
(this page was created automatically. In case of formatting issues, please visit the official Wiki Page)
Number Input
Link to Figma: https://www.figma.com/design/yck1tcUXgdQ5aYX6iUAwrO/GE---Astronaut-Design-System?node-id=11628-202370&t=ftfrOGkPzlG2GaTo-1
Overview
- The Dynamic Number Input Component captures numerical values in forms.
- It includes built-in validation and formatting options.
- It is suited for precise numeric entry such as prices, quantities, or measurements.
- It improves form usability by handling numeric formats directly within the input.
...
- dataTestId – Sets the testing hook ID for automated testing. For example, setting to "product-price-input" allows test scripts to reliably locate this component.
Guidelines
[NO DATA AVAILABLE]
Accessibility
...
Usage
- Use for numeric-only entry that needs built-in constraints and formatting; enforce limits with
validation.required,validation.min,validation.max, set precision withstep, and activate checks viavalidated. - Pre-fill working values with
value; define reset behavior withdefaultValueso the field returns to the intended baseline on reset. - Preserve in-progress input across reloads by enabling
saveInLocalStorage: true.
Sizing & Layout
- The component exposes no explicit size/padding tokens. Prevent wrapping/overflow by keeping copy concise when using
labelTranslationsandhelperText. - Choose
stepvalues that avoid long fractional tails (e.g.,0.5,0.25) to keep caret movement and keyboard incrementing predictable.
States & Feedback
- Validation state: turn on
validatedand configurevalidation.required,validation.min,validation.maxfor immediate guardrails. - Read-only state: present values without allowing edits via
readonly: true.
Data-Driven / Conditional Behavior
- Express domain limits via
validation.minandvalidation.max; ensurevalidated: trueso limits apply during entry. - Match domain precision with
step; users should never be able to increment into unsupported decimals. - Define reset semantics with
defaultValuedistinct fromvalue.
Visibility & Authorization
- Hide inputs that are not applicable with
hidden: true. - When users may see but must not edit, keep the field visible and disable interaction via
authorizationDisable.
Content & Localization
- Provide a clear, localized label using
labelTranslations(plain language, sentence case). - Align numeric formatting expectations to locale by choosing
thousandSeparator(e.g.,","or `".").
Dos & Don’ts
| Do | Don’t | Article setting(s) |
|---|---|---|
Set step to match the smallest valid increment (e.g., 0.5). | Leave the default and force trial-and-error increments. | step |
Enforce domain limits with validation.min/validation.max and enable validated. | Allow any number and reject only at submit time. | validation.min, validation.max, validated |
Format large values using thousandSeparator. | Show long digit strings without separators. | thousandSeparator |
| Separate working value from reset value. | Use value expecting it to reset automatically. | value, defaultValue |
| Persist drafts in long flows. | Make users retype values after a reload. | saveInLocalStorage |
| Display computed results as read-only. | Show computed values as editable fields. | readonly, value |
| Hide fields that aren’t relevant. | Leave irrelevant inputs visible and empty. | hidden |
| Localize visible labels. | Hard-code English labels. | labelTranslations |
| Map data explicitly for submission. | Rely on implicit names or default request placement. | dataField, controlsRequestType |
| Clamp or react to edits on change. | Ignore ON_VALUE_CHANGE and let invalid states propagate. | events.ON_VALUE_CHANGE |
Accessibility
- Ensure an accessible name is present via
labelTranslations. - Convey non-editable state with
readonlyso assistive tech does not present it as interactive. - Provide deterministic automation hooks for accessibility tests using
dataTestId. - Avoid color-only meaning: rely on behavioral constraints using
validatedandvalidation.*to prevent and communicate invalid input, and onreadonlyto indicate calculated/locked values. - Choose
stepvalues that align with domain expectations to reduce repeated key presses and cursor repositioning for keyboard users.