androidx.compose.material3

TextFieldColors

Class

No hand-written docs yet.

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

class TextFieldColors(
    focusedTextColor: Color,
    unfocusedTextColor: Color,
    disabledTextColor: Color,
    errorTextColor: Color,
    focusedContainerColor: Color,
    unfocusedContainerColor: Color,
    disabledContainerColor: Color,
    errorContainerColor: Color,
    cursorColor: Color,
    errorCursorColor: Color,
    textSelectionColors: TextSelectionColors,
    focusedIndicatorColor: Color,
    unfocusedIndicatorColor: Color,
    disabledIndicatorColor: Color,
    errorIndicatorColor: Color,
    focusedLeadingIconColor: Color,
    unfocusedLeadingIconColor: Color,
    disabledLeadingIconColor: Color,
    errorLeadingIconColor: Color,
    focusedTrailingIconColor: Color,
    unfocusedTrailingIconColor: Color,
    disabledTrailingIconColor: Color,
    errorTrailingIconColor: Color,
    focusedLabelColor: Color,
    unfocusedLabelColor: Color,
    disabledLabelColor: Color,
    errorLabelColor: Color,
    focusedPlaceholderColor: Color,
    unfocusedPlaceholderColor: Color,
    disabledPlaceholderColor: Color,
    errorPlaceholderColor: Color,
    focusedSupportingTextColor: Color,
    unfocusedSupportingTextColor: Color,
    disabledSupportingTextColor: Color,
    errorSupportingTextColor: Color,
    focusedPrefixColor: Color,
    unfocusedPrefixColor: Color,
    disabledPrefixColor: Color,
    errorPrefixColor: Color,
    focusedSuffixColor: Color,
    unfocusedSuffixColor: Color,
    disabledSuffixColor: Color,
    errorSuffixColor: Color,
)

How to get one

Create it

Ready-made values and functions that return it

Used by

Parameters that take a TextFieldColors.

Properties

focusedTextColor

val focusedTextColor: Color

unfocusedTextColor

val unfocusedTextColor: Color

disabledTextColor

val disabledTextColor: Color

errorTextColor

val errorTextColor: Color

focusedContainerColor

val focusedContainerColor: Color

unfocusedContainerColor

val unfocusedContainerColor: Color

disabledContainerColor

val disabledContainerColor: Color

errorContainerColor

val errorContainerColor: Color

cursorColor

val cursorColor: Color

errorCursorColor

val errorCursorColor: Color

textSelectionColors

val textSelectionColors: TextSelectionColors

focusedIndicatorColor

val focusedIndicatorColor: Color

unfocusedIndicatorColor

val unfocusedIndicatorColor: Color

disabledIndicatorColor

val disabledIndicatorColor: Color

errorIndicatorColor

val errorIndicatorColor: Color

focusedLeadingIconColor

val focusedLeadingIconColor: Color

unfocusedLeadingIconColor

val unfocusedLeadingIconColor: Color

disabledLeadingIconColor

val disabledLeadingIconColor: Color

errorLeadingIconColor

val errorLeadingIconColor: Color

focusedTrailingIconColor

val focusedTrailingIconColor: Color

unfocusedTrailingIconColor

val unfocusedTrailingIconColor: Color

disabledTrailingIconColor

val disabledTrailingIconColor: Color

errorTrailingIconColor

val errorTrailingIconColor: Color

focusedLabelColor

val focusedLabelColor: Color

unfocusedLabelColor

val unfocusedLabelColor: Color

disabledLabelColor

val disabledLabelColor: Color

errorLabelColor

val errorLabelColor: Color

focusedPlaceholderColor

val focusedPlaceholderColor: Color

unfocusedPlaceholderColor

val unfocusedPlaceholderColor: Color

disabledPlaceholderColor

val disabledPlaceholderColor: Color

errorPlaceholderColor

val errorPlaceholderColor: Color

focusedSupportingTextColor

val focusedSupportingTextColor: Color

unfocusedSupportingTextColor

val unfocusedSupportingTextColor: Color

disabledSupportingTextColor

val disabledSupportingTextColor: Color

errorSupportingTextColor

val errorSupportingTextColor: Color

focusedPrefixColor

val focusedPrefixColor: Color

unfocusedPrefixColor

val unfocusedPrefixColor: Color

disabledPrefixColor

val disabledPrefixColor: Color

errorPrefixColor

val errorPrefixColor: Color

focusedSuffixColor

val focusedSuffixColor: Color

unfocusedSuffixColor

val unfocusedSuffixColor: Color

disabledSuffixColor

val disabledSuffixColor: Color

errorSuffixColor

val errorSuffixColor: Color

Functions

copy

fun copy(
    focusedTextColor: Color = this.focusedTextColor,
    unfocusedTextColor: Color = this.unfocusedTextColor,
    disabledTextColor: Color = this.disabledTextColor,
    errorTextColor: Color = this.errorTextColor,
    focusedContainerColor: Color = this.focusedContainerColor,
    unfocusedContainerColor: Color = this.unfocusedContainerColor,
    disabledContainerColor: Color = this.disabledContainerColor,
    errorContainerColor: Color = this.errorContainerColor,
    cursorColor: Color = this.cursorColor,
    errorCursorColor: Color = this.errorCursorColor,
    textSelectionColors: TextSelectionColors? = this.textSelectionColors,
    focusedIndicatorColor: Color = this.focusedIndicatorColor,
    unfocusedIndicatorColor: Color = this.unfocusedIndicatorColor,
    disabledIndicatorColor: Color = this.disabledIndicatorColor,
    errorIndicatorColor: Color = this.errorIndicatorColor,
    focusedLeadingIconColor: Color = this.focusedLeadingIconColor,
    unfocusedLeadingIconColor: Color = this.unfocusedLeadingIconColor,
    disabledLeadingIconColor: Color = this.disabledLeadingIconColor,
    errorLeadingIconColor: Color = this.errorLeadingIconColor,
    focusedTrailingIconColor: Color = this.focusedTrailingIconColor,
    unfocusedTrailingIconColor: Color = this.unfocusedTrailingIconColor,
    disabledTrailingIconColor: Color = this.disabledTrailingIconColor,
    errorTrailingIconColor: Color = this.errorTrailingIconColor,
    focusedLabelColor: Color = this.focusedLabelColor,
    unfocusedLabelColor: Color = this.unfocusedLabelColor,
    disabledLabelColor: Color = this.disabledLabelColor,
    errorLabelColor: Color = this.errorLabelColor,
    focusedPlaceholderColor: Color = this.focusedPlaceholderColor,
    unfocusedPlaceholderColor: Color = this.unfocusedPlaceholderColor,
    disabledPlaceholderColor: Color = this.disabledPlaceholderColor,
    errorPlaceholderColor: Color = this.errorPlaceholderColor,
    focusedSupportingTextColor: Color = this.focusedSupportingTextColor,
    unfocusedSupportingTextColor: Color = this.unfocusedSupportingTextColor,
    disabledSupportingTextColor: Color = this.disabledSupportingTextColor,
    errorSupportingTextColor: Color = this.errorSupportingTextColor,
    focusedPrefixColor: Color = this.focusedPrefixColor,
    unfocusedPrefixColor: Color = this.unfocusedPrefixColor,
    disabledPrefixColor: Color = this.disabledPrefixColor,
    errorPrefixColor: Color = this.errorPrefixColor,
    focusedSuffixColor: Color = this.focusedSuffixColor,
    unfocusedSuffixColor: Color = this.unfocusedSuffixColor,
    disabledSuffixColor: Color = this.disabledSuffixColor,
    errorSuffixColor: Color = this.errorSuffixColor,
): TextFieldColors

Returns a copy of this ChipColors, optionally overriding some of the values. This uses the Color.Unspecified to mean “use the value from the source”

leadingIconColorSince 1.10

fun leadingIconColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

trailingIconColorSince 1.10

fun trailingIconColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

indicatorColorSince 1.10

fun indicatorColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

containerColorSince 1.10

fun containerColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

Represents the container color for this text field.

placeholderColorSince 1.10

fun placeholderColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

labelColorSince 1.10

fun labelColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

textColorSince 1.10

fun textColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

supportingTextColorSince 1.10

fun supportingTextColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

Represents the colors used for the supporting text of this text field.

prefixColorSince 1.10

fun prefixColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

suffixColorSince 1.10

fun suffixColor(
    enabled: Boolean,
    isError: Boolean,
    focused: Boolean,
): Color

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

fun cursorColor(isError: Boolean): Color

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

Library docs

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