Number Field
Allows users to enter a number in a text field or use buttons to increment or decrement the value.
The label attribute provides a short description of the purpose of the Number Field.
If a visible label can't be used, provide one using the aria-label
The placeholder attribute provides an example of the type of input the user needs to enter.
Avoid using placeholder text as a substitute for a label. Placeholder text is not a reliable label—it disappears when users type and is not always announced by screen readers. Use a label element to ensure the Combobox is both visually and programmatically associated with a descriptive label.
The helper-text attribute provides additional information to help the user enter the correct information.
To add HTML to the helper text, use the helper-text slot.
You can add the Contextual Help component using the contextual-help slot. It will be displayed next to the label, providing users additional information.
Set the value attribute to set the default value for the number field.
Setting the property on the element will not change the default value, but will change the value shown in the view as well as the submitted value in a form (imitating the native behavior).
Values always use the period (".") as the decimal separator, regardless of the user's locale.
Only the value on the screen is localized.
Use the valueAsNumber property to get or set the value as a number. If no valid value is entered in the field, the valueAsNumber is NaN.
The success-text attribute provides a custom success message. Any current error state will be overridden by success-text.
The scale attribute controls the Text Field input element display size.
Use condensed in situations when space is limited, for example, inside a Data Grid cell.
The reason for using scale for form elements and not size (as used in other components such as Button), is that size is a HTML attribute that can be used on input elements (and also Number Field) to control the width of the input.
The shape attribute controls the border radius of the Number Field input element.
The appearance attribute controls the style of the Number Field input element.
Use ghost in combination with a containing element which provides a border, for example Action Group.
Add the disabled attribute to disable the Number field input element.
The readonly attribute prevents the user from changing the Number Field input element value.