# KeyboardOptions

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/text/KeyboardOptions.kt+class:androidx.compose.foundation.text.KeyboardOptions) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  class KeyboardOptions
  ```

*** ** * ** ***

Defines keyboard configuration options for TextFields.

Represents specific layout, capitalization, and system action hints sent to the Input Method Editor (IME/software keyboard) on focus gain.

Soft keyboards make best-effort attempts to comply with the options provided here. Key layouts and flag behaviors are ultimately determined by the active IME implementation.

```kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.TextFieldLineLimits
import androidx.compose.foundation.text.input.TextObfuscationMode
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.OutlinedSecureTextField
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp

val nameState = rememberTextFieldState()
val emailState = rememberTextFieldState()
val passwordState = rememberTextFieldState()
var isPasswordVisible by remember { mutableStateOf(false) }
val urlState = rememberTextFieldState()
val addressState = rememberTextFieldState()
val biographyState = rememberTextFieldState()

Column(
    verticalArrangement = Arrangement.spacedBy(12.dp),
    modifier = Modifier.padding(16.dp).fillMaxWidth(),
) {
    // 1. PersonName Input (Auto-Capitalizes Words)
    OutlinedTextField(
        state = nameState,
        label = { Text("Full Name") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.PersonName,
                capitalization = KeyboardCapitalization.Words,
                imeAction = ImeAction.Next, // Soft keyboard automatically moves focus on Next
            ),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 2. Email Input (Restricted layout showing '@' and '.', auto-capitalization disabled)
    OutlinedTextField(
        state = emailState,
        label = { Text("Email") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.Email,
                capitalization = KeyboardCapitalization.None,
                imeAction = ImeAction.Next,
            ),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 3. Password Input with Eye-Icon Toggle (masked vs visible password layouts,
    // capitalizations disabled)
    Row(verticalAlignment = Alignment.CenterVertically) {
        OutlinedSecureTextField(
            state = passwordState,
            label = { Text("Password") },
            textObfuscationMode =
                if (isPasswordVisible) TextObfuscationMode.Visible
                else TextObfuscationMode.System,
            keyboardOptions =
                KeyboardOptions(
                    keyboardType =
                        if (isPasswordVisible) KeyboardType.PasswordVisible
                        else KeyboardType.Password,
                    capitalization = KeyboardCapitalization.None,
                    imeAction = ImeAction.Next,
                ),
            modifier = Modifier.weight(0.7f),
        )
        Spacer(Modifier.width(8.dp))
        TextButton(
            onClick = { isPasswordVisible = !isPasswordVisible },
            modifier = Modifier.weight(0.3f),
        ) {
            Text(if (isPasswordVisible) "Hide" else "Show")
        }
    }

    // 4. Uri Input (Prominent '/' and '.com' keys, auto-capitalization disabled)
    OutlinedTextField(
        state = urlState,
        label = { Text("Homepage URL") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.Uri,
                capitalization = KeyboardCapitalization.None,
                imeAction = ImeAction.Next,
            ),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 5. PostalAddress Input (Auto-Capitalizes Words, prompts standard shipping keys)
    OutlinedTextField(
        state = addressState,
        label = { Text("Shipping Address") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.PostalAddress,
                capitalization = KeyboardCapitalization.Words,
                imeAction = ImeAction.Next,
            ),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 6. Free-Text Biography Input (Auto-Capitalizes Sentences, multi-line active)
    OutlinedTextField(
        state = biographyState,
        label = { Text("Biography") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.Text,
                capitalization = KeyboardCapitalization.Sentences,
                imeAction =
                    ImeAction.Done, // Soft keyboard automatically dismisses keyboard on Done
            ),
        modifier = Modifier.fillMaxWidth(),
    )
}
```

```kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.InputTransformation
import androidx.compose.foundation.text.input.TextFieldLineLimits
import androidx.compose.foundation.text.input.allCaps
import androidx.compose.foundation.text.input.byValue
import androidx.compose.foundation.text.input.maxLengthTrim
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.OutlinedSecureTextField
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLocale
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp

val cashierPinState = rememberTextFieldState()
val qtyState = rememberTextFieldState()
val phoneState = rememberTextFieldState()
val couponState = rememberTextFieldState()
val balanceOffsetState = rememberTextFieldState()

val pinLength = 4

Column(
    verticalArrangement = Arrangement.spacedBy(12.dp),
    modifier = Modifier.padding(16.dp).fillMaxWidth(),
) {
    // 1. NumberPassword PIN Entry (Masked secure numeric pad (0-9))
    OutlinedSecureTextField(
        state = cashierPinState,
        label = { Text("Enter Cashier PIN (OTP)") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.NumberPassword,
                imeAction = ImeAction.Next,
            ),
        inputTransformation =
            InputTransformation.byValue { _, proposed -> proposed.filter { it.isDigit() } }
                .maxLengthTrim(pinLength),
        modifier = Modifier.fillMaxWidth(),
    )

    // 2. Number Plain Integer Input (Pure numeric key entry for quantities)
    OutlinedTextField(
        state = qtyState,
        label = { Text("Item Quantity Count") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.Number, imeAction = ImeAction.Next),
        inputTransformation =
            InputTransformation.byValue { _, proposed -> proposed.filter { it.isDigit() } },
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 4. Phone Contact Entry (Displays telephony dialer keyboard with '+', '*', '#')
    OutlinedTextField(
        state = phoneState,
        label = { Text("Customer Loyalty Phone Number") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.Phone, imeAction = ImeAction.Next),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 5. Ascii / KeyboardCapitalization.Characters (Uppercase restricted ASCII promo vouchers)
    OutlinedTextField(
        state = couponState,
        label = { Text("Promo Coupon Code") },
        inputTransformation = InputTransformation.allCaps(LocalLocale.current),
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.Ascii,
                capitalization = KeyboardCapitalization.Characters,
                autoCorrectEnabled = false,
                imeAction = ImeAction.Next,
            ),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 6. DecimalSigned Shared Offset Balance Adjustments (Allows decimal coordinates and
    // negative/positive signs)
    OutlinedTextField(
        state = balanceOffsetState,
        label = { Text("Add Balance Offset (Debits/Credits)") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.DecimalSigned,
                imeAction = ImeAction.Done,
            ),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )
}
```

```kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.TextFieldLineLimits
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp

val birthState = rememberTextFieldState()
val timerState = rememberTextFieldState()
val meetingState = rememberTextFieldState()

Column(
    verticalArrangement = Arrangement.spacedBy(12.dp),
    modifier = Modifier.padding(16.dp).fillMaxWidth(),
) {
    // 1. Date Input (Prompt numeric layout tailored for dates containing '/' or '-')
    OutlinedTextField(
        state = birthState,
        label = { Text("Birthdate (YYYY/MM/DD)") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.Date, imeAction = ImeAction.Next),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 2. Time Input (Prompt numeric layout tailored for times containing ':')
    OutlinedTextField(
        state = timerState,
        label = { Text("Timer Preset Clock (HH:MM)") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.Time, imeAction = ImeAction.Next),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 3. DateTime Input (Prompts clock-calendar layout option)
    OutlinedTextField(
        state = meetingState,
        label = { Text("Combined Meeting Timestamp (YYYY/MM/DD HH:MM)") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.DateTime, imeAction = ImeAction.Done),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )
}
```

```kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.TextFieldLineLimits
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.OutlinedSecureTextField
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp

val filterState = rememberTextFieldState()
val phoneticState = rememberTextFieldState()
val maskedCoordsState = rememberTextFieldState()
val maskedBalanceState = rememberTextFieldState()
val maskedPasskeyState = rememberTextFieldState()

Column(
    verticalArrangement = Arrangement.spacedBy(12.dp),
    modifier = Modifier.padding(16.dp).fillMaxWidth(),
) {
    // 1. Filter Input (Optimized list filtering, auto-capitalization/suggestions disabled)
    OutlinedTextField(
        state = filterState,
        label = { Text("Search Query") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.Filter,
                capitalization = KeyboardCapitalization.None,
                imeAction = ImeAction.Next,
            ),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 2. Phonetic Input (For phonetic readings/pronunciations, e.g. phonetic names in contacts)
    OutlinedTextField(
        state = phoneticState,
        label = { Text("Phonetic Name") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.Phonetic, imeAction = ImeAction.Next),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    // 3. DecimalPassword Input (Masked numeric pad showing decimal separators)
    OutlinedSecureTextField(
        state = maskedCoordsState,
        label = { Text("Secure Decimal Value") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.DecimalPassword,
                imeAction = ImeAction.Next,
            ),
        modifier = Modifier.fillMaxWidth(),
    )

    // 4. NumberPasswordSigned Input (Masked numeric pad showing positive/negative signs)
    OutlinedSecureTextField(
        state = maskedBalanceState,
        label = { Text("Secure Signed Value") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.NumberPasswordSigned,
                imeAction = ImeAction.Next,
            ),
        modifier = Modifier.fillMaxWidth(),
    )

    // 5. DecimalPasswordSigned Input (Masked numeric pad showing both decimals and signs)
    OutlinedSecureTextField(
        state = maskedPasskeyState,
        label = { Text("Secure Decimal Signed Value") },
        keyboardOptions =
            KeyboardOptions(
                keyboardType = KeyboardType.DecimalPasswordSigned,
                imeAction = ImeAction.Done,
            ),
        modifier = Modifier.fillMaxWidth(),
    )
}
```

```kotlin
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicSecureTextField
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.InputTransformation
import androidx.compose.foundation.text.input.byValue
import androidx.compose.foundation.text.input.maxLengthTrim
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp

val pinState = rememberTextFieldState()
val pinLength = 4

BasicSecureTextField(
    state = pinState,
    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword),
    inputTransformation =
        InputTransformation.byValue { _, proposed -> proposed.filter { it.isDigit() } }
            .maxLengthTrim(pinLength),
    decorator = { innerTextField ->
        Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
            repeat(pinLength) { index ->
                val char = pinState.text.getOrNull(index)
                Box(
                    modifier =
                        Modifier.size(48.dp)
                            .border(
                                1.dp,
                                if (pinState.text.length == index) Color.Blue else Color.Gray,
                                RoundedCornerShape(8.dp),
                            ),
                    contentAlignment = Alignment.Center,
                ) {
                    if (char != null) {
                        Text("●")
                    }
                }
            }
        }
    },
)
```

```kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.TextFieldLineLimits
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp

val latitudeState = rememberTextFieldState("37.7749")
val longitudeState = rememberTextFieldState("-122.4194")

Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
    OutlinedTextField(
        state = latitudeState,
        label = { Text("Latitude") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.Decimal, imeAction = ImeAction.Next),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )

    OutlinedTextField(
        state = longitudeState,
        label = { Text("Longitude") },
        keyboardOptions =
            KeyboardOptions(keyboardType = KeyboardType.Decimal, imeAction = ImeAction.Done),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )
}
```

```kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.TextFieldLineLimits
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp

val countState = rememberTextFieldState("100")
val isError by remember {
    derivedStateOf {
        val parsed = countState.text.toString().toIntOrNull()
        parsed == null || parsed <= 0
    }
}

Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
    OutlinedTextField(
        state = countState,
        label = { Text("List Item Display Count") },
        isError = isError,
        keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
        lineLimits = TextFieldLineLimits.SingleLine,
        modifier = Modifier.fillMaxWidth(),
    )
    if (isError) {
        Text("Value must be a positive integer", color = Color.Red)
    }
}
```

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#Default()` Provides default `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions`. | Cmn |

| ### Public constructors |
|---|---|
| `[KeyboardOptions](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#KeyboardOptions(androidx.compose.ui.text.input.KeyboardCapitalization,kotlin.Boolean,androidx.compose.ui.text.input.KeyboardType,androidx.compose.ui.text.input.ImeAction,androidx.compose.ui.text.input.PlatformImeOptions,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList))( capitalization: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization, autoCorrect: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, keyboardType: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType, imeAction: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction, platformImeOptions: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/PlatformImeOptions?, showKeyboardOnFocus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html?, hintLocales: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList? )` **This function is deprecated.** Please use the new constructor that takes optional autoCorrectEnabled parameter. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#KeyboardOptions(androidx.compose.ui.text.input.KeyboardCapitalization,kotlin.Boolean,androidx.compose.ui.text.input.KeyboardType,androidx.compose.ui.text.input.ImeAction,androidx.compose.ui.text.input.PlatformImeOptions,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)( capitalization: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization, autoCorrectEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html?, keyboardType: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType, imeAction: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction, platformImeOptions: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/PlatformImeOptions?, showKeyboardOnFocus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html?, hintLocales: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList? )` | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#copy(androidx.compose.ui.text.input.KeyboardCapitalization,kotlin.Boolean,androidx.compose.ui.text.input.KeyboardType,androidx.compose.ui.text.input.ImeAction,androidx.compose.ui.text.input.PlatformImeOptions,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)( capitalization: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization, autoCorrectEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html?, keyboardType: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType, imeAction: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction, platformImeOptions: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/PlatformImeOptions?, showKeyboardOnFocus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html?, hintLocales: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList? )` Returns a copy of this object with the values passed to this method. | Cmn |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#merge(androidx.compose.foundation.text.KeyboardOptions)(other: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions?)` Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions` that is a combination of this options and a given `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#merge(androidx.compose.foundation.text.KeyboardOptions)` options. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#autoCorrect()` **This property is deprecated.** Please use the autoCorrectEnabled property. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#autoCorrectEnabled()` informs the keyboard whether to enable auto-correct suggestions. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#capitalization()` informs the keyboard whether to automatically capitalize characters, words, or sentences. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList?` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#hintLocales()` list of languages for IMEs. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#imeAction()` action button displayed on the soft keyboard (e.g., search, send, next, done, etc.). | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#keyboardType()` keyboard keypad layout to be displayed in the focused text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/PlatformImeOptions?` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#platformImeOptions()` platform-specific IME options (like private IME commands). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#showKeyboardOnFocus()` when true, the soft keyboard shows immediately on text field focus gain. | Cmn |

## Public companion properties

### Default

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)

```
val Default: KeyboardOptions
```

Provides default `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions`. See parameter descriptions for default values.

## Public constructors

### KeyboardOptions

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0) Deprecated in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
[KeyboardOptions](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#KeyboardOptions(androidx.compose.ui.text.input.KeyboardCapitalization,kotlin.Boolean,androidx.compose.ui.text.input.KeyboardType,androidx.compose.ui.text.input.ImeAction,androidx.compose.ui.text.input.PlatformImeOptions,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList))(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified,
    autoCorrect: Boolean,
    keyboardType: KeyboardType = KeyboardType.Unspecified,
    imeAction: ImeAction = ImeAction.Unspecified,
    platformImeOptions: PlatformImeOptions? = null,
    showKeyboardOnFocus: Boolean? = null,
    hintLocales: LocaleList? = null
)
```

> [!CAUTION]
> **This function is deprecated.**   
> Please use the new constructor that takes optional autoCorrectEnabled parameter, use this instead:
>
> ```kotlin
> KeyboardOptions(capitalization = capitalization, autoCorrectEnabled = autoCorrect, keyboardType = keyboardType, imeAction = imeAction,platformImeOptions = platformImeOptions, showKeyboardOnFocus = showKeyboardOnFocus,hintLocales = hintLocales)
> ```

### KeyboardOptions

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
KeyboardOptions(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified,
    autoCorrectEnabled: Boolean? = null,
    keyboardType: KeyboardType = KeyboardType.Unspecified,
    imeAction: ImeAction = ImeAction.Unspecified,
    platformImeOptions: PlatformImeOptions? = null,
    showKeyboardOnFocus: Boolean? = null,
    hintLocales: LocaleList? = null
)
```

| Parameters |
|---|---|
| `capitalization: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization = KeyboardCapitalization.Unspecified` | informs the keyboard whether to automatically capitalize characters, words, or sentences. Only applicable to text-based `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType`s such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Text()`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Ascii()`, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#PostalAddress()`. It is ignored by soft keyboards when paired with numeric layouts (like `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Number()` or `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Decimal()`). |
| `autoCorrectEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html? = null` | informs the keyboard whether to enable auto-correct suggestions. Only applicable to text-based `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType`s such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Text()`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Email()`, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Uri()`. Keyboards ignore this value for numeric keypads. A null value (the default parameter value) expresses that soft keyboard default configurations should apply. |
| `keyboardType: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType = KeyboardType.Unspecified` | keyboard keypad layout to be displayed in the focused text field. Honored by keyboards to display tailored key selections (e.g., phone dialer characters for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Phone()`, decimal separator buttons for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Decimal()`, or masked numeric pads for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#NumberPassword()`). |
| `imeAction: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction = ImeAction.Unspecified` | action button displayed on the soft keyboard (e.g., search, send, next, done, etc.). This action is honored by the software keyboard and may display custom icons (like a magnifying glass for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction#Search()`). When the text field allows multi-line inputs, the keyboard typically displays a return key instead of the action icon requested here. |
| `platformImeOptions: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/PlatformImeOptions? = null` | platform-specific IME options (like private IME commands). |
| `showKeyboardOnFocus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html? = null` | when true, the soft keyboard shows immediately on text field focus gain. When false, the soft keyboard is hidden until the user taps the text field. A null value (the default parameter value) enables showing the keyboard automatically on focus gain. Note: This option is only supported by TextFieldState-based TextFields (like BasicTextField) and is ignored by legacy TextFields. |
| `hintLocales: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList? = null` | list of languages for IMEs. Provides a localized hint to help multilingual keyboards automatically shift their keyboard language based on the active field's context. |

## Public functions

### copy

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
fun copy(
    capitalization: KeyboardCapitalization = this.capitalization,
    autoCorrectEnabled: Boolean? = this.autoCorrectEnabled,
    keyboardType: KeyboardType = this.keyboardType,
    imeAction: ImeAction = this.imeAction,
    platformImeOptions: PlatformImeOptions? = this.platformImeOptions,
    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 `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#merge(androidx.compose.foundation.text.KeyboardOptions)`, which will never take an unspecified value over a specified one.

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### merge

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

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

Returns a new `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions` that is a combination of this options and a given `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#merge(androidx.compose.foundation.text.KeyboardOptions)` options.

`https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#merge(androidx.compose.foundation.text.KeyboardOptions)`s null or `Unspecified` properties are replaced with the non-null properties of this object.

If the either this or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardOptions#merge(androidx.compose.foundation.text.KeyboardOptions)` is null, returns the non-null one.

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### autoCorrect

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0) Deprecated in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

```
val autoCorrect: Boolean
```

> [!CAUTION]
> **This property is deprecated.**   
> Please use the autoCorrectEnabled property.

### autoCorrectEnabled

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

```
val autoCorrectEnabled: Boolean?
```

informs the keyboard whether to enable auto-correct suggestions. Only applicable to text-based `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType`s such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Text()`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Email()`, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Uri()`. Keyboards ignore this value for numeric keypads. A null value (the default parameter value) expresses that soft keyboard default configurations should apply.

### capitalization

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)

```
val capitalization: KeyboardCapitalization
```

informs the keyboard whether to automatically capitalize characters, words, or sentences. Only applicable to text-based `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType`s such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Text()`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Ascii()`, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#PostalAddress()`. It is ignored by soft keyboards when paired with numeric layouts (like `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Number()` or `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Decimal()`).

### hintLocales

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

```
val hintLocales: LocaleList?
```

list of languages for IMEs. Provides a localized hint to help multilingual keyboards automatically shift their keyboard language based on the active field's context.

### imeAction

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)

```
val imeAction: ImeAction
```

action button displayed on the soft keyboard (e.g., search, send, next, done, etc.). This action is honored by the software keyboard and may display custom icons (like a magnifying glass for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction#Search()`). When the text field allows multi-line inputs, the keyboard typically displays a return key instead of the action icon requested here.

### keyboardType

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)

```
val keyboardType: KeyboardType
```

keyboard keypad layout to be displayed in the focused text field. Honored by keyboards to display tailored key selections (e.g., phone dialer characters for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Phone()`, decimal separator buttons for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#Decimal()`, or masked numeric pads for `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/KeyboardType#NumberPassword()`).

### platformImeOptions

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.6.0)

```
val platformImeOptions: PlatformImeOptions?
```

platform-specific IME options (like private IME commands).

### showKeyboardOnFocus

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

```
val showKeyboardOnFocus: Boolean?
```

when true, the soft keyboard shows immediately on text field focus gain. When false, the soft keyboard is hidden until the user taps the text field. A null value (the default parameter value) enables showing the keyboard automatically on focus gain. Note: This option is only supported by TextFieldState-based TextFields (like BasicTextField) and is ignored by legacy TextFields.