---
title: "TextFieldColors"
description: "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 [TextFieldDefaults.textFieldColors] for the default colors used in [TextField]. See
[TextFieldDefaults.outlinedTextFieldColors] for the default colors used in [OutlinedTextField]."
type: "interface"
---

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


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

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



```kotlin
interface TextFieldColors
```


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 `TextFieldDefaults.textFieldColors` for the default colors used in `TextField`. See
`TextFieldDefaults.outlinedTextFieldColors` for the default colors used in `OutlinedTextField`.


## Functions

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


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

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |



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


Represents the background color for this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |



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


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

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |



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


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

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| error | 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 | the `InteractionSource` of this text field. Helps to determine if the text field is in focus or not |



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


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

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |



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


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

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| interactionSource | the `InteractionSource` of this text field. Helps to determine if the text field is in focus or not |



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


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

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |



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


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

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| interactionSource | the `InteractionSource` of this text field. Helps to determine if the text field is in focus or not |



```kotlin
@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 | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| interactionSource | the `InteractionSource` of this text field. Helps to determine if the text field is in focus or not |



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


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

#### Parameters

| | |
| --- | --- |
| isError | whether the text field's current value is in error |




