Back to Momentum Firmware

Text input GUI view {#js_gui__text_input}

documentation/js/js_gui__text_input.md

latest1.6 KB
Original Source

Text input GUI view {#js_gui__text_input}

Displays a keyboard.

js
let eventLoop = require("event_loop");
let gui = require("gui");
let textInputView = require("gui/text_input");

This module depends on the gui module, which in turn depends on the event_loop module, so they must be imported in this order. It is also recommended to conceptualize these modules first before using this one.

Example

For an example, refer to the gui.js example script.

View props

PropTypeDescription
minLengthnumberThe shortest allowed text length.
maxLengthnumberThe longest allowed text length.
Default: 32
headerstringA single line of text that appears above the keyboard.
defaultTextstringText to show by default.
defaultTextClearbooleanWhether to clear the default text on next character typed.
illegalSymbolsbooleanWhether to show illegal filename symbols.
Available with JS feature gui-textinput-illegalsymbols

View events

ItemTypeDescription
inputstringFires when the user selects the "Save" button and the text matches the length constrained by minLength and maxLength.