NumInput Component Reference

Table of Contents


Introduction

Syntax

tml`<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).

Numeric Input types

The input may be rendered in several forms depending on the inputType attribute. The inputType attribute may take on the following values:

Plus-Minus layout

The 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.

Attributes


Instance methods

These methods are intended to be used by parent components to dynamically change the properties of the rendered components without re-rendering.

Inherited methods


getValue()

Syntax

getValue()

Returns the current value of the rendered element.

Return value

A Number, or a String if the user has typed into a keyboard input. Not available when valueOnly (a NumOutput is rendered, whose getValue() is not defined).


setDisabled()

Syntax

setDisabled(b)

Sets the rendered element's disabled property to b and adds or removes the input-disabled CSS class. Not available when valueOnly: it forwards to the NumOutput component, which has no setDisabled() method, so it throws.

Parameters


setFmt()

Syntax

setFmt(fmt)

Sets the rendered element's min, max, and step from the fmt instance (step is fmt.step; the keypad and thumbwheel types set only min and max). Not available when valueOnly (it throws).

Parameters


setValue()

Syntax

setValue(value)

Sets the rendered element's value.

Parameters


setClassName()

Syntax

setClassName(cn)

Replaces the rendered element's CSS class string with cn plus numInput (and input-disabled if the input is disabled). If cn is omitted, the component's current class name is used.

Parameters


Children

The NumInput component ignores all children.


DOM element properties

The NumInput is rendered in several different ways: