Skip to main content
Version: 4.60

textBox

The textBox layer allows user input in text form. It is used when the user is required to enter information such as a username.

Field Configurations

KeyTypeDescriptionDefault Value
"autoComplete"Objectundefinednull
"autoCorrection"BooleanUse the system's autocorrect features.false
"automaticCapitalisation"AutomaticCapitalisationUse the systems's automatic capitalisation feature."sentence"
"clearButtonColor"ColorThe color of the clear button."#cccccc"
"closeKeyboardOnReturn"BooleanClose the keyboard if the user presses the return key.false
"font"StringFont name to use.null
"fontColor"ColorThe font color."#000000"
"fontScalable"Boolean,StringDetermines if this font will be scaled by the OS font scale factor.false
"fontSize"UnitSizeFont size to use.10
"hasClearButton"BooleanShows a clear button at the end of the text box.true
"hint"StringThe placeholder hint.null
"hintFontColor"ColorThe placeholder font color. Default: System placeholder color.null
"iOS_scrollParentGridToSelf"BooleaniOS only. Workaround to let a grid scroll it's text box to the current view.false
"inputAccessoryBackgroundColor"ColorThe background color of the input accessory view of the keyboard."#ffffff"
"inputAccessoryEnabled"BooleanDetermines, if the text box should display a keyboard with accessory view.true
"inputAccessoryHeight"NumberHeight of the input accessory view of the keyboard.56
"inputAccessoryTitle"StringText of the done button of the keyboard accessory."Localized verison of 'done'"
"inputAccessoryTitleColor"ColorThe font color of the input accessory view label of the keyboard."#000000"
"inputAccessoryTitleFont"StringFont to use for the input accessory view label of the keyboardnull
"inputAccessoryTitleFontSize"UnitSizeFont size to use for the input accessory view label of the keyboard.12
"inputType"TextBoxInputTypeDefines the text box's content type. Does not affect the keyboard type. Translates to UITextContentType on iOS. The value text enables all kinds of system's autocorrect features."text"
"isPassword"BooleanUse this to have a password text box, that only shows dots instead of the actual characters.false
"keyboardLayout"KeyboardLayoutChanges the keyboard layout. Translates to UIKeyboardType on iOS.null
"lineBreakMode"LineBreakModeThe line break mode."truncateEnd"
"maxLines"NumberLine count.1
"preferredLanguage"StringThe preferred keyboard language. This is a ISO 639 language code.null
"readOnly"Booleanundefinedfalse
"returnActions"ArrayAction to fire if the return key was pressed.null
"returnKeyType"ReturnKeyTypeChanges the type of the return key on the keyboard. Translates to UIReturnKeyType on iOS.null
"scaleToFit"BooleanIf true, the text box will automatically shrink to its minimum size.null
"scaleType"ScaleTypeDefines how an element should fit into the layer's frame.null
"textAlign"TextAlignThe alignment of the text."left"
"useBackground"BooleanDetermines whether the text box should look like a system text box.false

Inherited

From Form Layer

Form Layer

Field Configurations

KeyTypeDescriptionDefault Value
"form"StringName of the form e.g. used to access the value of the form outside of its view.null
"formDataKey"StringDatakey used to access the value of the form layer.null
"onChanged"ArrayActions to execute when the form value is changed.null
"settingsDataKey"StringIf set, the value of the form layer will be written into the _settings table. DEPRECATED Use onChanged to save values in the database.null
"validationErrorMessage"StringMessage to display in case the input is invalid.null
"validationExpression"StringRegex to use in the validateForm action.null
"valueActionIndex"StringIndex of the value action.null
"valueActions"ArrayActions to be executed when a specified value is set e.g. hiding a layer when a checkbox is selected.null
From Base Layer

Base Layer

Field Configurations

KeyTypeDescriptionDefault Value
"_value"Value[PREVIEW] Dynamic value of the layer.null
"accessibilityAppendState"StringDefines this layer appends its state to the accessibility text.null
"accessibilityText"StringText for accessibility navigation. Can be translated.null
"actions"ActionListList of actions, which will be executed when the layer is tapped.null
"borderColor"ColorThe color of the border in hex color value.null
"borderRadius"UnitSizeThe radius applies to all corners; with a borderWidth of 0 the border is not drawn and radius is set anyway.0
"borderWidth"UnitSizeThe width of the border.0
"bottomLeftRadius"UnitSizeRadius for the bottom left corner.0
"bottomRightRadius"UnitSizeRadius for the bottom right corner.0
"classes"ArrayList of classes for layer styles.null
"conditions"ConditionsList of conditions to alter the layer state.null
"constraints"ConstraintsA list of constraints defining the position of the layer in a layout.null
"consumesKeyboard"BooleanThis layer will be used to shrink, if a keyboard is shown.null
"dataKey"StringName for assigning data to this layer.null
"focusColor"ColorThe highlight color of this layer when it is focused. Mainly used on TV. If no color is provided, the pressedColor will be used.null
"hidden"BooleanIndicates whether the layer is hidden. Default: false.false
"isAccessibilityElement"StringDefines if this layer is important for accessibility navigation. The default depends on the layer type.null
"layerRotation"NumberThe layer is rotated by the specified degree.0
"name"StringUnique name in the layout. Used for alignment or actions.null
"opacity"NumberThe opacity of the layer.1
"overInsetBottom"BooleanDetermines if this layer ignores the save space at the bottom of the device.false
"overInsetTop"BooleanDetermines if this layer ignores the save space at the top of the device.false
"pressedColor"ColorThe highlight color of this layer when it is pressed. Mainly used on TV. If no color is provided, the focusColor will be used.null
"safeArea"SafeAreaTypeObjectDetermines the safe area behaviour.null
"shadowElevation"NumberThe elevation of this layer for casting shadows.0
"state"StringThe state the layer will use as default."default"
"states"LayerStatesA list of named states that affect the appearance of the layer.null
"topLeftRadius"UnitSizeRadius for the top left corner.0
"topRightRadius"UnitSizeRadius for the top right corner.0
"touchFeedback"TouchFeedbackDetermines if the layer should show a touch feedback if touched."visible"
"trackingKey"StringDefines a key for a scroll event.null
"type"LayerTypeThe type of the layernull
"value"Value(Initial) value of the layer.null

Examples

Example 1: Create a text box for a nickname.

Goal: Create a text box with a specific size, font and hint.

To achieve this the following code can be used:

{
"type": "textBox",
"name": "nickName",
"dataKey": "nickName",
"formDataKey": "nickName",
"font": "Raleway-Regular",
"fontSize": "30dp",
"hint": "Please enter your nickname",
"hintFontColor": "#585B5B",
"constraints": [
{
"type": "pos",
"anchor": "nw",
"x": "05%",
"y": "40%"
},
{
"type": "size",
"width": "90%",
"height": "70pt"
}
]
}

Result:

Screenshot of the app showing the results of the sample code from Example 1. Screenshot of the app showing the results of the sample code from Example 1.
A textBox has been created.

Example 2: textBox with autoComplete

Goal: Create a textBox with autoComplete possibility. Autocomplete should be a zip code, which are defined in extra data base

To do so, you have to define resultTemplate, displayTemplate, displayLayout and specific query in autoComplete block:

{
"type": "textBox",
"formDataKey": "autocomplete",
"fontColor": "#000000",
"textFont": "Roboto-Regular",
"fontSize": "20pt",
"scaleType": "alignBottomLeft",
"hint": "Please enter your zip code",
"hintFontColor": "#585B5B",
"keyboardLayout": "NumberPad",
"autoComplete": {
"query": {
"table": "autocomplete",
"name": "zipLike",
"ranked": true
},
"resultTemplate": "zip_result",
"displayTemplate": "zip_display",
"displayLayout": "p_text",
"displayAspectRatio": 2,
"minCharacters": 2,
"horizontalOffset": "-20dp",
"verticalOffset": "5dp"
},
"constraints": [
{
"type": "pos",
"anchor": "nw",
"x": "05%",
"y": "40%"
},
{
"type": "size",
"width": "90%",
"height": "70pt"
}
]
}

The autoComplete configuration is defined in corresponding database table.

Result:

Screenshot of the app showing the results of the sample code from Example 2. Screenshot of the app showing the results of the sample code from Example 2.
A textBox with autocomplete functionality has been created.