# TextFieldColors

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

  ```
  interface TextFieldColors
  ```
Known direct subclasses [TextFieldColorsWithIcons](https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColorsWithIcons)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColorsWithIcons` | **This interface is deprecated.** Empty interface; use parent TextFieldColors instead |

*** ** * ** ***

Represents the colors of the input text, background and content (including label, placeholder, leading and trailing icons) used in a text field in different states.

See `https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldDefaults#textFieldColors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` for the default colors used in `https://developer.android.com/reference/kotlin/androidx/compose/material/TextField.composable#TextField(androidx.compose.foundation.text.input.TextFieldState,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.compose.ui.text.TextStyle,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Boolean,androidx.compose.foundation.text.input.InputTransformation,androidx.compose.foundation.text.input.OutputTransformation,androidx.compose.foundation.text.KeyboardOptions,androidx.compose.foundation.text.input.KeyboardActionHandler,androidx.compose.foundation.text.input.TextFieldLineLimits,androidx.compose.foundation.ScrollState,androidx.compose.ui.graphics.Shape,androidx.compose.material.TextFieldColors,androidx.compose.foundation.interaction.MutableInteractionSource)`. See `https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldDefaults#outlinedTextFieldColors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` for the default colors used in `https://developer.android.com/reference/kotlin/androidx/compose/material/OutlinedTextField.composable#OutlinedTextField(androidx.compose.foundation.text.input.TextFieldState,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.compose.ui.text.TextStyle,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Boolean,androidx.compose.foundation.text.input.InputTransformation,androidx.compose.foundation.text.input.OutputTransformation,androidx.compose.foundation.text.KeyboardOptions,androidx.compose.foundation.text.input.KeyboardActionHandler,androidx.compose.foundation.text.input.TextFieldLineLimits,androidx.compose.foundation.ScrollState,androidx.compose.ui.graphics.Shape,androidx.compose.material.TextFieldColors,androidx.compose.foundation.interaction.MutableInteractionSource)`.

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#backgroundColor(kotlin.Boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Represents the background color for this text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#cursorColor(kotlin.Boolean)(isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Represents the color used for the cursor of this text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#indicatorColor(kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.InteractionSource)( enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource )` Represents the color used for the border indicator of this text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#labelColor(kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.InteractionSource)( enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, error: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource )` Represents the color used for the label of this text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable [leadingIconColor](https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#leadingIconColor(kotlin.Boolean,kotlin.Boolean))(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` **This function is deprecated.** Use/implement overload with interactionSource parameter | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#leadingIconColor(kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.InteractionSource)( enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource )` Represents the color used for the leading icon of this text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#placeholderColor(kotlin.Boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Represents the color used for the placeholder of this text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#textColor(kotlin.Boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Represents the color used for the input text of this text field. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable [trailingIconColor](https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#trailingIconColor(kotlin.Boolean,kotlin.Boolean))(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` **This function is deprecated.** Use/implement overload with interactionSource parameter | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#trailingIconColor(kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.InteractionSource)( enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource )` Represents the color used for the trailing icon of this text field. | Cmn |

## Public functions

### backgroundColor

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

```
@Composable
fun backgroundColor(enabled: Boolean): State<Color>
```

Represents the background color for this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |

### cursorColor

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

```
@Composable
fun cursorColor(isError: Boolean): State<Color>
```

Represents the color used for the cursor of this text field.

| Parameters |
|---|---|
| `isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field's current value is in error |

### indicatorColor

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

```
@Composable
fun indicatorColor(
    enabled: Boolean,
    isError: Boolean,
    interactionSource: InteractionSource
): State<Color>
```

Represents the color used for the border indicator of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |
| `isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field's current value is in error |
| `interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` of this text field. Helps to determine if the text field is in focus or not |

### labelColor

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

```
@Composable
fun labelColor(
    enabled: Boolean,
    error: Boolean,
    interactionSource: InteractionSource
): State<Color>
```

Represents the color used for the label of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |
| `error: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field should show error color according to the Material specifications. If the label is being used as a placeholder, this will be false even if the input is invalid, as the placeholder should not use the error color |
| `interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` of this text field. Helps to determine if the text field is in focus or not |

### leadingIconColor

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

```
@Composable
fun [leadingIconColor](https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#leadingIconColor(kotlin.Boolean,kotlin.Boolean))(enabled: Boolean, isError: Boolean): State<Color>
```

> [!CAUTION]
> **This function is deprecated.**   
> Use/implement overload with interactionSource parameter, use this instead:
>
> ```kotlin
> leadingIconColor(enabled, isError, interactionSource)
> ```

Represents the color used for the leading icon of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |
| `isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field's current value is in error |

### leadingIconColor

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

```
@Composable
open fun leadingIconColor(
    enabled: Boolean,
    isError: Boolean,
    interactionSource: InteractionSource
): State<Color>
```

Represents the color used for the leading icon of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |
| `isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field's current value is in error |
| `interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` of this text field. Helps to determine if the text field is in focus or not |

### placeholderColor

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

```
@Composable
fun placeholderColor(enabled: Boolean): State<Color>
```

Represents the color used for the placeholder of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |

### textColor

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

```
@Composable
fun textColor(enabled: Boolean): State<Color>
```

Represents the color used for the input text of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |

### trailingIconColor

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

```
@Composable
fun [trailingIconColor](https://developer.android.com/reference/kotlin/androidx/compose/material/TextFieldColors#trailingIconColor(kotlin.Boolean,kotlin.Boolean))(enabled: Boolean, isError: Boolean): State<Color>
```

> [!CAUTION]
> **This function is deprecated.**   
> Use/implement overload with interactionSource parameter, use this instead:
>
> ```kotlin
> trailingIconColor(enabled, isError, interactionSource)
> ```

Represents the color used for the trailing icon of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |
| `isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field's current value is in error |

### trailingIconColor

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

```
@Composable
open fun trailingIconColor(
    enabled: Boolean,
    isError: Boolean,
    interactionSource: InteractionSource
): State<Color>
```

Represents the color used for the trailing icon of this text field.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field is enabled |
| `isError: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the text field's current value is in error |
| `interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` of this text field. Helps to determine if the text field is in focus or not |