NumInput Component ReferenceNumOutput Component Referencetml`<NumInput .../>`
The NumInput component creates renders a numeric input. It is a separate component used by the Numeric Input state variable so that it can be reused by other components.
The numeric limits and format is set by the fmt attribute. See NumFmt Reference.
The NumInput component has several methods that can be used to allow parent components to dynamically manipulate the state of the rendered elements. See [Instance methods](#instance methods).
The input may be rendered in several forms depending on the inputType attribute. The inputType attribute may take on the following values:
keyboardkeypadthumbwheelThe rendered component also depends on the plusMinus, verticaland title attributes. If the plusMinus attribute is present and truthy, the input, as specified by the inputType attribute, is surrounded by a '-' button and a '+' button. These buttons will decrement or increment the input according to the rndMult property of the NumFmt specified in the fmt attribute. If the vertical attribute is present and truthy, the buttons appear above and below the input. Lastly, the title attribute specifies a title to appear above the plusMinus input.
NumInput component accepts the standard attributes.disabledfmtinputTypekeyboard (default)keypadthumbwheelplusMinustitletitle attribute is ignored if the plusMinus attribute is not present or falsey.unitsvaluevalueOnlyverticalvertical attribute is ignored if the plusMinus attribute is not present or falsey.These methods are intended to be used by parent components to dynamically change the properties of the rendered components without re-rendering.
getValue()getValue()
Returns the current value of the rendered element.
A Number.
setDisabled()setDisabled(b)
Sets the rendered element's disabled property to b.
bsetFmt()setFmt(fmt)
Sets the rendered element's min, max, and step from the fmt instance.
bsetValue()setValue(value)
Sets the rendered element's value.
valueThe NumInput component ignores all children.
The NumInput is rendered in several different ways:
valueOnly attribute is truthy, the input is rendered using a NumOutput component.inputType attribute is keyboard, it will render an <input> element. The element type will be <input type=number> when the element has the focus and will be <input type=text> when it does not.inputType attribute is keypad or thumbwheel it will render an <span> element that, when clicked, will display a popup numeric keypad or numeric thumbwheel. The <span> will have input and popupInput CSS class strings.numInput CSS class string.width property of the fmt attribute.<input type=number>, the min, max, and step properties will be set according to the min, max, and rndMult properties of the fmt attribute, respectively. The <input>element's disabled property will be set according to the current disabled state.units attribute is present, the numeric input and a <span> containing the unit abbreviation are contained in an NbSpan component. The <span> containing the unit abbreviation will have a numUnits CSS class string.