---
title: "KeyboardOptions"
description: "The keyboard configuration options for TextFields. It is not guaranteed if software keyboard will
comply with the options provided here."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
class KeyboardOptions(
    val capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified,
    @Suppress("AutoBoxing") @get:Suppress("AutoBoxing") val autoCorrectEnabled: Boolean? = null,
    val keyboardType: KeyboardType = KeyboardType.Unspecified,
    val imeAction: ImeAction = ImeAction.Unspecified,
    val platformImeOptions: PlatformImeOptions? = null,
    @Suppress("AutoBoxing") @get:Suppress("AutoBoxing") val showKeyboardOnFocus: Boolean? = null,
    @get:Suppress("NullableCollection") val hintLocales: LocaleList? = null,
)
```


The keyboard configuration options for TextFields. It is not guaranteed if software keyboard will
comply with the options provided here.

#### Parameters

| | |
| --- | --- |
| capitalization | informs the keyboard whether to automatically capitalize characters, words or sentences. Only applicable to only text based `KeyboardType`s such as `KeyboardType.Text`, `KeyboardType.Ascii`. It will not be applied to `KeyboardType`s such as `KeyboardType.Number`. |
| autoCorrectEnabled | informs the keyboard whether to enable auto correct. Only applicable to text based `KeyboardType`s such as `KeyboardType.Email`, `KeyboardType.Uri`. It will not be applied to `KeyboardType`s such as `KeyboardType.Number`. Most of keyboard implementations ignore this value for `KeyboardType`s such as `KeyboardType.Text`. A null value (the default parameter value) means autocorrect will be enabled. |
| keyboardType | The keyboard type to be used in this text field. Note that this input type is honored by keyboard and shows corresponding keyboard but this is not guaranteed. For example, some keyboards may send non-ASCII character even if you set `KeyboardType.Ascii`. |
| imeAction | The IME action. This IME action is honored by keyboard and may show specific icons on the keyboard. For example, search icon may be shown if `ImeAction.Search` is specified. When `ImeOptions.singleLine` is false, the keyboard might show return key rather than the action requested here. |
| platformImeOptions | defines the platform specific IME options. |
| showKeyboardOnFocus | when true, software keyboard will show on focus gain. When false, the user must interact (e.g. tap) before the keyboard is shown. A null value (the default parameter value) means the keyboard will be shown on focus. |
| hintLocales | List of the languages that the user is supposed to switch to no matter what input method subtype is currently used. This special "hint" can be used mainly for, but not limited to, multilingual users who want IMEs to switch language based on editor's context. Pass null to express the intention that a specific hint should not be set. |



## Secondary Constructors

```kotlin
constructor(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified,
    autoCorrect: Boolean,
    keyboardType: KeyboardType = KeyboardType.Unspecified,
    imeAction: ImeAction = ImeAction.Unspecified,
    platformImeOptions: PlatformImeOptions? = null,
    @Suppress("AutoBoxing") showKeyboardOnFocus: Boolean? = null,
    @Suppress("NullableCollection") hintLocales: LocaleList? = null,
) : this(
    capitalization = capitalization,
    autoCorrectEnabled = autoCorrect,
    keyboardType = keyboardType,
    imeAction = imeAction,
    platformImeOptions = platformImeOptions,
    showKeyboardOnFocus = showKeyboardOnFocus,
    hintLocales = hintLocales,
)
```

```kotlin
constructor(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified,
    autoCorrect: Boolean = Default.autoCorrectOrDefault,
    keyboardType: KeyboardType = KeyboardType.Unspecified,
    imeAction: ImeAction = ImeAction.Default,
) : this(
    capitalization = capitalization,
    autoCorrectEnabled = autoCorrect,
    keyboardType = keyboardType,
    imeAction = imeAction,
    platformImeOptions = null,
)
```

```kotlin
constructor(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.None,
    autoCorrect: Boolean = Default.autoCorrectOrDefault,
    keyboardType: KeyboardType = KeyboardType.Text,
    imeAction: ImeAction = ImeAction.Default,
    platformImeOptions: PlatformImeOptions? = null,
) : this(
    capitalization = capitalization,
    autoCorrectEnabled = autoCorrect,
    keyboardType = keyboardType,
    imeAction = imeAction,
    platformImeOptions = platformImeOptions,
    showKeyboardOnFocus = Default.showKeyboardOnFocusOrDefault,
)
```

## Properties

<div class='sourceset sourceset-common'>Common</div>


> **Deprecated** Please use the autoCorrectEnabled property.

```kotlin
val autoCorrect: Boolean
```


<div class='sourceset sourceset-common'>Common</div>


> **Deprecated** Included for binary compatibility. Use showKeyboardOnFocus.

```kotlin
val shouldShowKeyboardOnFocus: Boolean
```


## Functions

```kotlin
fun copy(
        capitalization: KeyboardCapitalization = this.capitalization,
        @Suppress("AutoBoxing") autoCorrectEnabled: Boolean? = this.autoCorrectEnabled,
        keyboardType: KeyboardType = this.keyboardType,
        imeAction: ImeAction = this.imeAction,
        platformImeOptions: PlatformImeOptions? = this.platformImeOptions,
        @Suppress("AutoBoxing") showKeyboardOnFocus: Boolean? = null,
        hintLocales: LocaleList? = null,
    ): KeyboardOptions
```


Returns a copy of this object with the values passed to this method.

Note that if an unspecified (null) value is passed explicitly to this method, it will replace
any actually-specified value. This differs from the behavior of `merge`, which will never
take an unspecified value over a specified one.


```kotlin
fun copy(
        capitalization: KeyboardCapitalization = this.capitalization,
        autoCorrect: Boolean = this.autoCorrectOrDefault,
        keyboardType: KeyboardType = this.keyboardType,
        imeAction: ImeAction = this.imeAction,
        platformImeOptions: PlatformImeOptions? = this.platformImeOptions,
        @Suppress("AutoBoxing") showKeyboardOnFocus: Boolean? = this.showKeyboardOnFocusOrDefault,
        hintLocales: LocaleList? = this.hintLocales,
    ): KeyboardOptions
```

```kotlin
fun copy(
        capitalization: KeyboardCapitalization = this.capitalization,
        autoCorrect: Boolean = this.autoCorrectOrDefault,
        keyboardType: KeyboardType = this.keyboardType,
        imeAction: ImeAction = this.imeAction,
        platformImeOptions: PlatformImeOptions? = this.platformImeOptions,
    ): KeyboardOptions
```

```kotlin
fun copy(
        capitalization: KeyboardCapitalization = this.capitalization,
        autoCorrect: Boolean = this.autoCorrectOrDefault,
        keyboardType: KeyboardType = this.keyboardType,
        imeAction: ImeAction = this.imeAction,
    ): KeyboardOptions
```

```kotlin
fun merge(other: KeyboardOptions?): KeyboardOptions
```


Returns a new `KeyboardOptions` that is a combination of this options and a given `other`
options.

`other`s null or `Unspecified` properties are replaced with the non-null properties of this
object.

If the either this or `other` is null, returns the non-null one.


## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Default = KeyboardOptions()
```


Default `KeyboardOptions`. Please see parameter descriptions for default values.





