Tabris.js Widgets: TextInput

TextInput widget is a field that allows the user to enter text. It can be used similar to how input or textarea tags used in HTML. With the help of TextInput, you can create the most basic input forms – for login and registering, for editing profile information, for leaving a comment and many others.

Properties and events

  • Property enterKeyType allows you to change the icon for the “Enter” button on the keyboard. With values like next, send, search, go, you can make the input field function more intuitive. Try example #3 to see it in action;
  • Properties focused and keepFocus allow you to manipulate the keyboard focus. For example, on a login page, you can first set focus on the Username input and then change the focus to the Password input once the Username is submitted;
  • Using the keyboard property, you can set the keyboard type for an input field. For example, set the number type if the field should contain only numbers;
  • The message property allows you to display a hint when the input field is empty;
  • Set the type property to multiline to enable word-wrap and show text in multiple lines.

Examples

  1. Here are all TextInput styles, designed according to the Material Design specs. That example is written in JSX – an XML-like ECMAScript syntax extension that can make your Tabris.js code simple and more understandable, compared to JavaScript.

  2. TypeScript example of using different types of keyboards:
  3. Usage of different “Enter” key types

For more detailed information about the widget, use TextInput documentation page.