Class NumberInput

A class that represents an input field where only numbers can be entered.

@ extends Widget implements ValueWidget

Hierarchy (view full)

Implements

Constructors

  • Create a new number input field and initialize it.

    Parameters

    • Optional label: string = ''

      The label text.

    • Optional value: number = 0

      The initial value.

    • Optional callback: Function = null

      The function to call when the input is changed.

    Returns NumberInput

Properties

inputRef: HTMLInputElement
labelRef: HTMLDivElement
listeners: {
    [key: string]: Function[];
}

Type declaration

  • [key: string]: Function[]
ref: HTMLDivElement
value: any
view: View

Methods

  • Bind an input field to an object property.

    Parameters

    • obj: any

      The object to bind the property to.

    • prop: string

      The property to bind.

    Returns this

  • Add an input event listener to the input field.

    Parameters

    • f: Function

      The function to call when the input is changed.

    Returns this

  • Set the label of the input field.

    Parameters

    • label: string

      The new label text.

    Returns this