---
title: TextField
description: Text field in an alert.
---

Text field in an alert.

Use the text field to customize the appearance of the text entered into it.

You do not create create instances of this. Instead you should add a text field to an Alert using the `addTextField()` and `addSecureTextField()` on the alert.

## Properties

### font

Font of the text.

```typescript
font: Font
```

### isSecure

Hides the text that is entered when set to true.

```typescript
isSecure: bool
```

The default value is false.

### placeholder

Placeholder shown in the text field while it is empty.

```typescript
placeholder: string
```

### text

Text in the text field.

```typescript
text: string
```

### textColor

Color of the text.

```typescript
textColor: Color
```

## Methods

<span id="-centeraligntext" class="api-anchor"></span>

### centerAlignText()

Center aligns the text.

```typescript
centerAlignText()
```

<span id="-leftaligntext" class="api-anchor"></span>

### leftAlignText()

Left aligns the text.

```typescript
leftAlignText()
```

This is the default text alignment.

<span id="-rightaligntext" class="api-anchor"></span>

### rightAlignText()

Right aligns the text.

```typescript
rightAlignText()
```

<span id="-setdecimalpadkeyboard" class="api-anchor"></span>

### setDecimalPadKeyboard()

Use a numeric keyboard with a decimal point for entering text.

```typescript
setDecimalPadKeyboard()
```

<span id="-setdefaultkeyboard" class="api-anchor"></span>

### setDefaultKeyboard()

Use the default keyboard for entering text.

```typescript
setDefaultKeyboard()
```

<span id="-setemailaddresskeyboard" class="api-anchor"></span>

### setEmailAddressKeyboard()

Use a keyboard that prominently features the @, period and space characters.

```typescript
setEmailAddressKeyboard()
```

<span id="-setnumberpadkeyboard" class="api-anchor"></span>

### setNumberPadKeyboard()

Use a keyboard that prominently features the numbers 0 through 9.

```typescript
setNumberPadKeyboard()
```

<span id="-setnumbersandpunctuationkeyboard" class="api-anchor"></span>

### setNumbersAndPunctuationKeyboard()

Use a numeric keyboard with punctuation for entering text.

```typescript
setNumbersAndPunctuationKeyboard()
```

<span id="-setphonepadkeyboard" class="api-anchor"></span>

### setPhonePadKeyboard()

Use a keyboard that prominently feaetures the numbers 0 through 9 and the * and # characters.

```typescript
setPhonePadKeyboard()
```

<span id="-settwitterkeyboard" class="api-anchor"></span>

### setTwitterKeyboard()

Use a keyboard that prominently features the @ and # characters.

```typescript
setTwitterKeyboard()
```

<span id="-seturlkeyboard" class="api-anchor"></span>

### setURLKeyboard()

Use a keyboard that prominently faetures the period and slash characters and the ".com" string.

```typescript
setURLKeyboard()
```

<span id="-setwebsearchkeyboard" class="api-anchor"></span>

### setWebSearchKeyboard()

Use a keyboard that prominently features the space and period characters.

```typescript
setWebSearchKeyboard()
```