# Text Input Component

## Overview

The text input component is a field where app users can enter text, such as a name or email address.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FZIpQ97F7C0aNFm5Siloz%2Ftext%20input%20example.png?alt=media&#x26;token=7dd0a732-24f1-4618-8117-c7467a22be3b" alt="" width="188"><figcaption></figcaption></figure></div>

## Video Tutorial

### How to Implement Text Input Validation in Thunkable

In this tutorial, we’ll implement text input validation to disable a button until text input conditions are met.

{% embed url="<https://youtu.be/f69iezhyNno>" %}

{% hint style="warning" %}
You need to make your screen scrollable to prevent the text input from moving up when the keyboard appears.
{% endhint %}

## Properties

### Text Input

<table><thead><tr><th width="235">Property</th><th width="198.33333333333331">Data Type</th><th>Description</th><th data-hidden>Description</th></tr></thead><tbody><tr><td>Hint</td><td>text</td><td>The prompt text the user sees when the text input is empty (eg. <code>Type Email</code>).</td><td>The prompt text the user sees when the text input is empty (eg. <code>Type Here</code>).</td></tr><tr><td>Text</td><td>text</td><td>Populated text of the text input.</td><td>Populated text within the text input.</td></tr><tr><td>Keyboard</td><td>select from list <code>[default, email address, numeric, phone pad]</code></td><td>The keyboard style provided to a user when they tap into the text input. If none are selected, it will be the default standard keyboard.</td><td>Select the type of keyboard provided to your user when they click into the text input field. If n</td></tr><tr><td>Secure Text Entry</td><td>true/false</td><td>Toggle whether the input text is obscured as a user types (suitable for entering passwords and other sensitive information).</td><td>Toggle whether text is obscured as your end user types (suitable for entering passwords and other sensitive information)</td></tr><tr><td>Font</td><td>text</td><td>Set the font for the hint and text properties. Options can be found here: <a href="https://fonts.google.com/">Google Fonts</a>.</td><td>Set the font for the Hint and Text properties. Options can be found here: <a href="https://fonts.google.com/">Google Fonts</a>.</td></tr><tr><td>Font Italic (web app only)</td><td>true/false</td><td>Select whether hint and text are shown in italics<em>.</em></td><td>Select whether hint and text are shown in italics<em>.</em></td></tr><tr><td>Underline (web app only)</td><td>true/false</td><td>Select whether the hint and text are underlined.</td><td>Select whether the hint and text are underlined.</td></tr><tr><td>Strikethrough (web app only)</td><td>true/false</td><td>Apply strikethrough formatting to the hint and text. </td><td>Apply strikethrough formatting to the hint and text. </td></tr><tr><td>Writing Direction (iOS and web app only)</td><td>select from icons</td><td>Set whether text should be written left-to-right or right-to-left.</td><td>Set whether text should be written left-to-right or right-to-left.</td></tr><tr><td>Font Size</td><td>number in pixels</td><td>Set whether text should be written left-to-right or right-to-left.</td><td>Height of hint and text in pixels.</td></tr><tr><td>Letter Spacing</td><td>number in pixels</td><td>Spacing between letters in pixels.</td><td>Spacing between letters in pixels.</td></tr></tbody></table>

### Advanced Properties

<table><thead><tr><th width="233.33333333333331">Property</th><th width="206">Value</th><th>Description</th></tr></thead><tbody><tr><td>Editable</td><td>true/false</td><td>Toggle whether the user can edit the text.</td></tr><tr><td>Multiline</td><td>true/false</td><td>Toggle whether the user can enter multiple lines of text.</td></tr><tr><td>Auto Focus</td><td>true/false</td><td>Toggle whether the text input field is automatically in focus when the screen opens (i.e. the user doesn't need to tap into the field to focus).</td></tr><tr><td>Max Length (Android and iOS only)</td><td>number</td><td>Set the maximum number of characters of text your user can enter. Mobile only</td></tr><tr><td>Clear Button Mode (iOS only)</td><td>select from list <code>[never, while-editing, unless-editing, always]</code></td><td>Toggle when an iOS user has the option to clear the text input's text.</td></tr><tr><td>Input Color</td><td>Color</td><td>The color of the text input's text.</td></tr><tr><td>Background Color</td><td>color</td><td>The background color of the text input field.</td></tr><tr><td>Hint Text Color</td><td>color</td><td>The color of the text input's hint.</td></tr><tr><td>Selection Color (Android and iOS only)</td><td>color</td><td>The highlight color when a user selects a section of text.</td></tr></tbody></table>

### Layout

<table><thead><tr><th width="162.33333333333331">Property</th><th width="162">Value</th><th>Description</th></tr></thead><tbody><tr><td>X</td><td>coordinate value</td><td>Position of the upper left corner of the text input on the X-axis, where the left side of the screen is X=0.</td></tr><tr><td>Y</td><td>coordinate value</td><td>Position of the upper left corner of the text input on the Y-axis, where the top of the screen is Y=0.</td></tr><tr><td>Height</td><td>number in pixels</td><td>The text input's height is defined by a custom number of pixels.</td></tr><tr><td>Width</td><td>number in pixels</td><td>The text input's width is defined by a custom number of pixels.</td></tr><tr><td>Resize Mode</td><td>Stretch</td><td>Stretches the text input to fit the dimensions of the device's screen.</td></tr><tr><td>Resize Mode</td><td>Float in Place</td><td>Renders the text input in the same aspect ratio as the design, regardless of the device size.</td></tr></tbody></table>

### Style

<table><thead><tr><th width="185.33333333333331">Property</th><th>Value</th><th>Description</th></tr></thead><tbody><tr><td>Visible</td><td>true/false</td><td>Toggle whether users can see the text input.</td></tr><tr><td>Border Style</td><td>select from list <code>[solid, dotted, dashed]</code></td><td>Style of text input's border.</td></tr><tr><td>Border Color</td><td>color</td><td>Color of text input's border.</td></tr><tr><td>Border Width</td><td>number in pixels</td><td>The width of the text input's border is defined by a custom number of pixels.</td></tr><tr><td>Border Radius</td><td>number in pixels</td><td>The radius of the text input's border’s corners is defined by a custom number of pixels.</td></tr><tr><td>Shadow Color</td><td>color</td><td>The text input's shadow is the color selected. </td></tr><tr><td>Shadow Opacity</td><td>number between 0 and 100</td><td>The opacity of the text input's shadow.</td></tr><tr><td>Shadow Radius</td><td>number in pixels</td><td>The radius of the text input's shadow’s corners is defined by a custom number of pixels.</td></tr><tr><td>Shadow Offset</td><td>number in pixels</td><td>How far the text input's shadow should be offset, in height and width, is defined by a custom number of pixels.</td></tr></tbody></table>

## Text Input Blocks

To access the blocks specific to the text input component:

1. On the Design tab, add a **Text Input** component to a screen.
2. Navigate to the **Blocks** tab.
3. In the component tree on the left, click the name of the text input component.
4. A drawer of text input-specific blocks opens.

### Event Blocks

#### When Text Input Click

This event fires when the user clicks on the text input component.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MA5XvDmBvuGLtYvRyNI%2F-MA5a2sYZuetyRqmTAnj%2Fti_click.png?alt=media&#x26;token=25a46dae-d4a5-4972-a0f1-07fa8fe45b2c" alt=""></div>

#### When Text Input Unfocus&#x20;

This event fires when the component loses focus, i.e. the user clicks on another component.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MA5dKr2QQBdRDoyZtW9%2F-MA5djt4JlixOOeVW74q%2Fti_unfocus.png?alt=media&#x26;token=213c1219-6a0c-485d-b156-ba5a2a673b3b" alt=""></div>

#### When Text Input Submit&#x20;

This event fires when the enter or submit button is pressed on the device keyboard.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MA5dKr2QQBdRDoyZtW9%2F-MA5dlY4qkjBd_s4GyU-%2Fti_submit.png?alt=media&#x26;token=25dfb7d9-67ab-4a80-85ca-bb6cc18422f4" alt=""></div>

#### When Text Input Changes

This event fires whenever a character is added to or removed from the text input (i.e. whenever there is a change to the content of the text input).

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MA5dKr2QQBdRDoyZtW9%2F-MA5dmbJLTkuz23eY4Cl%2Fti_changes.png?alt=media&#x26;token=23b863b9-4dfa-4513-9c84-a0ebe96cddfb" alt=""></div>

### Properties Blocks

There are two types of property blocks: dark green "set" and light green "get" blocks. The specific blocks available vary according to the UI component.

The dark green set blocks allow you to change the component's properties using blocks. For example, if you don't want a button to be enabled for a user until they've typed a set number of characters into a text input component, you can use the button's dark green set button's disabled status block.

The light green get blocks allow you to access the properties of a component (e.g. color, font, width, text, etc.).&#x20;
