textfield Component
Use the textfield component to display an editable text input field.
{
"type": "textfield",
"text": "Hello!"
}
Properties
- linebreak
- "scroll" | "wrap"
- Default:
"scroll"
Behaviour when the text reaches the end of the line.
| Value | Description |
|---|---|
"scroll" |
Scroll horizontally. |
"wrap" |
Wrap the text on to a new line. |
Also see Shared Properties.
Event Triggers
This component dispatches the following event triggers:
| Trigger | Description |
|---|---|
"actioned" |
When the user presses return on the textfield. |
"changed" |
When the text changes via user input. |
"typingstopped" |
When the user stops typing in the textfield. |
Examples
Custom text field layout with button
This example represents a composite UI which centres the custom text field component and includes a button which clears the text when pressed.
{
"constraints": {
"position": "centre"
},
"type": "view",
"layout": "border",
"cornerradius": 16,
"padding": 16,
"background": "#121212",
"components": [
{
"id": "theTextField",
"type": "textfield",
"text": "Hello!",
"font": {
"size": 20
},
"bordertype": "none",
"background": null,
"focusring": false
},
{
"constraints": {
"position": "right"
},
"type": "button",
"text": "Clear",
"events": [
{
"triggers": "actioned",
"action": {
"type": "json",
"src": {
"update": {
"ids": {
"theTextField": {
"text": ""
}
}
}
}
}
}
]
}
]
}