TextFieldColors

Interface

Common
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

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

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

Parameters

enabledwhether the text field is enabled
@Composable fun backgroundColor(enabled: Boolean): State<Color>

Represents the background color for this text field.

Parameters

enabledwhether the text field is enabled
@Composable fun placeholderColor(enabled: Boolean): State<Color>

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

Parameters

enabledwhether the text field is enabled
@Composable
    fun labelColor(
        enabled: Boolean,
        error: Boolean,
        interactionSource: InteractionSource,
    ): State<Color>

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

Parameters

enabledwhether the text field is enabled
errorwhether 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
interactionSourcethe InteractionSource of this text field. Helps to determine if the text field is in focus or not
@Composable
    fun leadingIconColor(enabled: Boolean, isError: Boolean): State<Color>

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

Parameters

enabledwhether the text field is enabled
isErrorwhether the text field's current value is in error
@Composable
    fun leadingIconColor(
        enabled: Boolean,
        isError: Boolean,
        interactionSource: InteractionSource,
    ): State<Color>

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

Parameters

enabledwhether the text field is enabled
isErrorwhether the text field's current value is in error
interactionSourcethe InteractionSource of this text field. Helps to determine if the text field is in focus or not
@Composable
    fun trailingIconColor(enabled: Boolean, isError: Boolean): State<Color>

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

Parameters

enabledwhether the text field is enabled
isErrorwhether the text field's current value is in error
@Composable
    fun trailingIconColor(
        enabled: Boolean,
        isError: Boolean,
        interactionSource: InteractionSource,
    ): State<Color>

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

Parameters

enabledwhether the text field is enabled
isErrorwhether the text field's current value is in error
interactionSourcethe InteractionSource of this text field. Helps to determine if the text field is in focus or not
@Composable
    fun indicatorColor(
        enabled: Boolean,
        isError: Boolean,
        interactionSource: InteractionSource,
    ): State<Color>

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

Parameters

enabledwhether the text field is enabled
isErrorwhether the text field's current value is in error
interactionSourcethe InteractionSource of this text field. Helps to determine if the text field is in focus or not
@Composable fun cursorColor(isError: Boolean): State<Color>

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

Parameters

isErrorwhether the text field's current value is in error