Skip to main content
Version: 1.x

@microsoft/fast-foundation > NumberField

NumberField class

A Number Field Custom HTML Element. Based largely on the <input type="number" /> element.

start - Content which can be provided before the number field input

end - Content which can be provided after the number field input

  • The default slot for the label

step-up-glyph - The glyph for the step up control

step-down-glyph - The glyph for the step down control

label - The label

root - The element wrapping the control, including start and end slots

control - The element representing the input

controls - The step up and step down controls

step-up - The step up control

step-down - The step down control

input - Fires a custom 'input' event when the value has changed

change - Fires a custom 'change' event when the value has changed

Signature:
export declare class NumberField extends FormAssociatedNumberField 

Properties

PropertyModifiersTypeDescription
autofocusbooleanIndicates that this element should get focus after the page finishes loading. See autofocus HTML attribute for more information.
hideStepbooleanWhen true, spin buttons will not be rendered
liststringAllows associating a datalist to the element by https://developer.mozilla.org/en-US/docs/Web/API/Element/id.
maxnumberThe maximum the value can be
maxlengthnumberThe maximum number of characters a user can enter.
minnumberThe minimum the value can be
minlengthnumberThe minimum number of characters a user can enter.
placeholderstringSets the placeholder value of the element, generally used to provide a hint to the user.
readOnlybooleanWhen true, the control will be immutable by user interaction. See readonly HTML attribute for more information.
sizenumberSets the width of the element to a specified number of characters.
stepnumberAmount to increment or decrement the value by
valueAsNumbernumberThe value property, typed as a number.

Methods

MethodModifiersDescription
select()Selects all the text in the number field
stepDown()Decrements the value using the step value
stepUp()Increments the value using the step value