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

```kotlin
object TextFieldDefaults
```

Contains the default values used by [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField) and [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField).

## Properties

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

```kotlin
val MinHeight = 56.dp
```

The default min height applied to a [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField) and [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField). Note that you can
override it by applying Modifier.heightIn directly on a text field.

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

```kotlin
val MinWidth = 280.dp
```

The default min width applied to a [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField) and [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField). Note that you can
override it by applying Modifier.widthIn directly on a text field.

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

```kotlin
const val IconOpacity = 0.54f
```

The default opacity used for a [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField)'s and [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField)'s leading and trailing
icons color.

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

```kotlin
val TextFieldShape: Shape
```

The default shape used for a [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField)'s background

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

```kotlin
val OutlinedTextFieldShape: Shape
```

The default shape used for a [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField)'s background and border

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

```kotlin
val UnfocusedBorderThickness = 1.dp
```

The default thickness of the border in [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField) or indicator line in [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField)
in unfocused state.

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

```kotlin
val FocusedBorderThickness = 2.dp
```

The default thickness of the border in [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField) or indicator line in [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField)
in focused state.

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

```kotlin
const val BackgroundOpacity = 0.12f
```

The default opacity used for a [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField)'s background color.

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

```kotlin
const val UnfocusedIndicatorLineOpacity = 0.42f
```

The default opacity used for a [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField)'s indicator line color when text field is not
focused.

## Functions

<h2 id="indicatorline-enabled-iserror-interactionsource-colors-focusedindicatorlinethickness-unfocusedindicatorlinethickness">indicatorLine</h2>

```kotlin
fun Modifier.indicatorLine(
        enabled: Boolean,
        isError: Boolean,
        interactionSource: InteractionSource,
        colors: TextFieldColors,
        focusedIndicatorLineThickness: Dp = FocusedBorderThickness,
        unfocusedIndicatorLineThickness: Dp = UnfocusedBorderThickness,
    ) =
        composed(
            inspectorInfo =
                debugInspectorInfo {
                    name = "indicatorLine"
                    properties["enabled"] = enabled
                    properties["isError"] = isError
                    properties["interactionSource"] = interactionSource
                    properties["colors"] = colors
                    properties["focusedIndicatorLineThickness"] = focusedIndicatorLineThickness
                    properties["unfocusedIndicatorLineThickness"] = unfocusedIndicatorLineThickness
                }
        ) {
            val stroke =
                animateBorderStrokeAsState(
                    enabled = enabled,
                    isError = isError,
                    interactionSource = interactionSource,
                    colors = colors,
                    focusedBorderThickness = focusedIndicatorLineThickness,
                    unfocusedBorderThickness = unfocusedIndicatorLineThickness,
                )
            Modifier.drawIndicatorLine(stroke.value)
        }
```

A modifier to draw a default bottom indicator line for [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField). You can use this modifier
if you build your custom text field using `TextFieldDecorationBox`. The [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField) component
applies it automatically.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled. |
| isError | whether the text field's current value is in error. |
| interactionSource | the [InteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/InteractionSource) of this text field. Used to determine if the text field is in focus or not. |
| colors | [TextFieldColors](/jetpack-compose/androidx.compose.material/material/interfaces/TextFieldColors) used to resolve colors of the text field. |
| focusedIndicatorLineThickness | thickness of the indicator line when text field is focused. |
| unfocusedIndicatorLineThickness | thickness of the indicator line when text field is not focused. |

<hr class="docs-overload-divider">

<h2 id="borderbox-enabled-iserror-interactionsource-colors-shape-focusedborderthickness-unfocusedborderthickness">BorderBox</h2>

```kotlin
@Composable
    fun BorderBox(
        enabled: Boolean,
        isError: Boolean,
        interactionSource: InteractionSource,
        colors: TextFieldColors,
        shape: Shape = OutlinedTextFieldShape,
        focusedBorderThickness: Dp = FocusedBorderThickness,
        unfocusedBorderThickness: Dp = UnfocusedBorderThickness,
    )
```

Composable that draws a default border stroke in [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField). You can use it to draw
a border stroke in your custom text field based on `OutlinedTextFieldDecorationBox`. The
[OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField) component applies it automatically.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled. |
| isError | whether the text field's current value is in error. |
| interactionSource | the [InteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/InteractionSource) of this text field. Used to determine if the text field is in focus or not. |
| colors | [TextFieldColors](/jetpack-compose/androidx.compose.material/material/interfaces/TextFieldColors) used to resolve colors of the text field. |
| focusedBorderThickness | thickness of the [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField)'s border when it is in focused state. |
| unfocusedBorderThickness | thickness of the [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField)'s border when it is not in focused state. |

<hr class="docs-overload-divider">

<h2 id="textfieldwithlabelpadding-start-end-top-bottom">textFieldWithLabelPadding</h2>

```kotlin
fun textFieldWithLabelPadding(
        start: Dp = TextFieldPadding,
        end: Dp = TextFieldPadding,
        top: Dp = FirstBaselineOffset,
        bottom: Dp = TextFieldBottomPadding,
    ): PaddingValues
```

Default content padding applied to [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField) when there is a label.

Note that when the label is present, the "top" padding (unlike rest of the paddings) is a
distance between the label's last baseline and the top edge of the [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField). If the "top"
value is smaller than the last baseline of the label, then there will be no space between the
label and top edge of the [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField).

<hr class="docs-overload-divider">

<h2 id="textfieldwithoutlabelpadding-start-top-end-bottom">textFieldWithoutLabelPadding</h2>

```kotlin
fun textFieldWithoutLabelPadding(
        start: Dp = TextFieldPadding,
        top: Dp = TextFieldPadding,
        end: Dp = TextFieldPadding,
        bottom: Dp = TextFieldPadding,
    ): PaddingValues
```

Default content padding applied to [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField) when the label is null.

<hr class="docs-overload-divider">

<h2 id="outlinedtextfieldpadding-start-top-end-bottom">outlinedTextFieldPadding</h2>

```kotlin
fun outlinedTextFieldPadding(
        start: Dp = TextFieldPadding,
        top: Dp = TextFieldPadding,
        end: Dp = TextFieldPadding,
        bottom: Dp = TextFieldPadding,
    ): PaddingValues
```

Default content padding applied to [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField).

<hr class="docs-overload-divider">

<h2 id="textfieldcolors-textcolor-disabledtextcolor-backgroundcolor-cursorcolor-errorcursorcolor-focusedindicatorcolor-unfocusedindicatorcolor-disabledindicatorcolor-errorindicatorcolor-leadingiconcolor-disabledleadingiconcolor-errorleadingiconcolor-trailingiconcolor-disabledtrailingiconcolor-errortrailingiconcolor-focusedlabelcolor-unfocusedlabelcolor-disabledlabelcolor-errorlabelcolor-placeholdercolor-disabledplaceholdercolor">textFieldColors</h2>

```kotlin
@Composable
    fun textFieldColors(
        textColor: Color = LocalContentColor.current.copy(LocalContentAlpha.current),
        disabledTextColor: Color = textColor.copy(ContentAlpha.disabled),
        backgroundColor: Color = MaterialTheme.colors.onSurface.copy(alpha = BackgroundOpacity),
        cursorColor: Color = MaterialTheme.colors.primary,
        errorCursorColor: Color = MaterialTheme.colors.error,
        focusedIndicatorColor: Color = MaterialTheme.colors.primary.copy(alpha = ContentAlpha.high),
        unfocusedIndicatorColor: Color =
            MaterialTheme.colors.onSurface.copy(alpha = UnfocusedIndicatorLineOpacity),
        disabledIndicatorColor: Color = unfocusedIndicatorColor.copy(alpha = ContentAlpha.disabled),
        errorIndicatorColor: Color = MaterialTheme.colors.error,
        leadingIconColor: Color = MaterialTheme.colors.onSurface.copy(alpha = IconOpacity),
        disabledLeadingIconColor: Color = leadingIconColor.copy(alpha = ContentAlpha.disabled),
        errorLeadingIconColor: Color = leadingIconColor,
        trailingIconColor: Color = MaterialTheme.colors.onSurface.copy(alpha = IconOpacity),
        disabledTrailingIconColor: Color = trailingIconColor.copy(alpha = ContentAlpha.disabled),
        errorTrailingIconColor: Color = MaterialTheme.colors.error,
        focusedLabelColor: Color = MaterialTheme.colors.primary.copy(alpha = ContentAlpha.high),
        unfocusedLabelColor: Color = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
        disabledLabelColor: Color = unfocusedLabelColor.copy(ContentAlpha.disabled),
        errorLabelColor: Color = MaterialTheme.colors.error,
        placeholderColor: Color = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
        disabledPlaceholderColor: Color = placeholderColor.copy(ContentAlpha.disabled),
    ): TextFieldColors
```

Creates a [TextFieldColors](/jetpack-compose/androidx.compose.material/material/interfaces/TextFieldColors) that represents the default input text, background and content
(including label, placeholder, leading and trailing icons) colors used in a [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField).

<hr class="docs-overload-divider">

<h2 id="outlinedtextfieldcolors-textcolor-disabledtextcolor-backgroundcolor-cursorcolor-errorcursorcolor-focusedbordercolor-unfocusedbordercolor-disabledbordercolor-errorbordercolor-leadingiconcolor-disabledleadingiconcolor-errorleadingiconcolor-trailingiconcolor-disabledtrailingiconcolor-errortrailingiconcolor-focusedlabelcolor-unfocusedlabelcolor-disabledlabelcolor-errorlabelcolor-placeholdercolor-disabledplaceholdercolor">outlinedTextFieldColors</h2>

```kotlin
@Composable
    fun outlinedTextFieldColors(
        textColor: Color = LocalContentColor.current.copy(LocalContentAlpha.current),
        disabledTextColor: Color = textColor.copy(ContentAlpha.disabled),
        backgroundColor: Color = Color.Transparent,
        cursorColor: Color = MaterialTheme.colors.primary,
        errorCursorColor: Color = MaterialTheme.colors.error,
        focusedBorderColor: Color = MaterialTheme.colors.primary.copy(alpha = ContentAlpha.high),
        unfocusedBorderColor: Color =
            MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.disabled),
        disabledBorderColor: Color = unfocusedBorderColor.copy(alpha = ContentAlpha.disabled),
        errorBorderColor: Color = MaterialTheme.colors.error,
        leadingIconColor: Color = MaterialTheme.colors.onSurface.copy(alpha = IconOpacity),
        disabledLeadingIconColor: Color = leadingIconColor.copy(alpha = ContentAlpha.disabled),
        errorLeadingIconColor: Color = leadingIconColor,
        trailingIconColor: Color = MaterialTheme.colors.onSurface.copy(alpha = IconOpacity),
        disabledTrailingIconColor: Color = trailingIconColor.copy(alpha = ContentAlpha.disabled),
        errorTrailingIconColor: Color = MaterialTheme.colors.error,
        focusedLabelColor: Color = MaterialTheme.colors.primary.copy(alpha = ContentAlpha.high),
        unfocusedLabelColor: Color = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
        disabledLabelColor: Color = unfocusedLabelColor.copy(ContentAlpha.disabled),
        errorLabelColor: Color = MaterialTheme.colors.error,
        placeholderColor: Color = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
        disabledPlaceholderColor: Color = placeholderColor.copy(ContentAlpha.disabled),
    ): TextFieldColors
```

Creates a [TextFieldColors](/jetpack-compose/androidx.compose.material/material/interfaces/TextFieldColors) that represents the default input text, background and content
(including label, placeholder, leading and trailing icons) colors used in an
[OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField).

<hr class="docs-overload-divider">

<h2 id="textfielddecorationbox-value-innertextfield-enabled-singleline-visualtransformation-interactionsource-iserror-label-placeholder-leadingicon-trailingicon-shape-colors-contentpadding">TextFieldDecorationBox</h2>

```kotlin
@Composable
    fun TextFieldDecorationBox(
        value: String,
        innerTextField: @Composable () -> Unit,
        enabled: Boolean,
        singleLine: Boolean,
        visualTransformation: VisualTransformation,
        interactionSource: InteractionSource,
        isError: Boolean = false,
        label: @Composable (() -> Unit)? = null,
        placeholder: @Composable (() -> Unit)? = null,
        leadingIcon: @Composable (() -> Unit)? = null,
        trailingIcon: @Composable (() -> Unit)? = null,
        shape: Shape = TextFieldShape,
        colors: TextFieldColors = textFieldColors(),
        contentPadding: PaddingValues =
            if (label == null) {
                textFieldWithoutLabelPadding()
            } else {
                textFieldWithLabelPadding()
            },
    )
```

A decoration box used to create custom text fields based on
[Material Design filled text field](https://m2.material.io/components/text-fields#filled-text-field).

If your text field requires customising elements that aren't exposed by [TextField](/jetpack-compose/androidx.compose.material/material/components/TextField), consider
using this decoration box to achieve the desired design.

For example, if you need to create a dense text field, use `contentPadding` parameter to
decrease the paddings around the input field. If you need to customise the bottom indicator,
apply [indicatorLine](#indicatorline) modifier to achieve that.

Example of custom text field based on `TextFieldDecorationBox`:

#### Parameters

| | |
| --- | --- |
| value | the input `String` shown by the text field |
| innerTextField | input text field that this decoration box wraps. Pass the framework-controlled composable parameter `innerTextField` from the `decorationBox` lambda of the [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| enabled | the enabled state of the text field. When `false`, this decoration box will appear visually disabled. This must be the same value that is passed to [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| singleLine | indicates if this is a single line or multi line text field. This must be the same value that is passed to [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| visualTransformation | transforms the visual representation of the input `value`. This must be the same value that is passed to [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| interactionSource | the read-only [InteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/InteractionSource) representing the stream of [Interaction](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Interaction)s for this text field. You must first create and pass in your own `remember`ed [MutableInteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/MutableInteractionSource) instance to the [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField) for it to dispatch events. And then pass the same instance to this decoration box to observe [Interaction](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Interaction)s and customize the appearance / behavior of this text field in different states. |
| isError | indicates if the text field's current value is in an error state. When `true`, this decoration box will display its contents in an error color. |
| label | the optional label to be displayed inside the text field container. The default text style uses [Typography.caption](/jetpack-compose/androidx.compose.material/material/classes/Typography) when the label is minimized and [Typography.subtitle1](/jetpack-compose/androidx.compose.material/material/classes/Typography) when the label is expanded. |
| placeholder | the optional placeholder to be displayed when the text field is in focus and the input text is empty. The default text style for internal [Text](/jetpack-compose/androidx.compose.material/material/components/Text) is [Typography.subtitle1](/jetpack-compose/androidx.compose.material/material/classes/Typography). |
| leadingIcon | the optional leading icon to be displayed at the beginning of the text field container. |
| trailingIcon | the optional trailing icon to be displayed at the end of the text field container. |
| shape | the shape of the text field's container. |
| colors | [TextFieldColors](/jetpack-compose/androidx.compose.material/material/interfaces/TextFieldColors) that will be used to resolve the colors used for this text field decoration box in different states. See [TextFieldDefaults.textFieldColors](/jetpack-compose/androidx.compose.material/material/objects/TextFieldDefaults). Note: This parameter only affects the colors of elements in the decoration box. Elements of the [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField) (such as text color or cursor color) are unaffected and must be changed using the relevant parameters of [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| contentPadding | the spacing values to apply internally between the internals of text field and the decoration box container. You can use it to implement dense text fields or simply to control horizontal padding. Note that the padding values may not be respected if they are incompatible with the text field's size constraints or layout. See [TextFieldDefaults.textFieldWithLabelPadding](/jetpack-compose/androidx.compose.material/material/objects/TextFieldDefaults) and [TextFieldDefaults.textFieldWithoutLabelPadding](/jetpack-compose/androidx.compose.material/material/objects/TextFieldDefaults). |

<hr class="docs-overload-divider">

<h2 id="outlinedtextfielddecorationbox-value-innertextfield-enabled-singleline-visualtransformation-interactionsource-iserror-label-placeholder-leadingicon-trailingicon-shape-colors-contentpadding-border">OutlinedTextFieldDecorationBox</h2>

```kotlin
@Composable
    fun OutlinedTextFieldDecorationBox(
        value: String,
        innerTextField: @Composable () -> Unit,
        enabled: Boolean,
        singleLine: Boolean,
        visualTransformation: VisualTransformation,
        interactionSource: InteractionSource,
        isError: Boolean = false,
        label: @Composable (() -> Unit)? = null,
        placeholder: @Composable (() -> Unit)? = null,
        leadingIcon: @Composable (() -> Unit)? = null,
        trailingIcon: @Composable (() -> Unit)? = null,
        shape: Shape = OutlinedTextFieldShape,
        colors: TextFieldColors = outlinedTextFieldColors(),
        contentPadding: PaddingValues = outlinedTextFieldPadding(),
        border: @Composable () -> Unit = {
            BorderBox(enabled, isError, interactionSource, colors, shape)
        },
    )
```

A decoration box used to create custom text fields based on
[Material Design outlined text field](https://m2.material.io/components/text-fields#outlined-text-field).

If your text field requires customising elements that aren't exposed by [OutlinedTextField](/jetpack-compose/androidx.compose.material/material/components/OutlinedTextField),
consider using this decoration box to achieve the desired design.

For example, if you need to create a dense outlined text field, use `contentPadding`
parameter to decrease the paddings around the input field. If you need to change the
thickness of the border, use [border](/jetpack-compose/androidx.tv/tv-material/classes/Border) parameter to achieve that.

Example of custom text field based on `OutlinedTextFieldDecorationBox`:

#### Parameters

| | |
| --- | --- |
| value | the input `String` shown by the text field |
| innerTextField | input text field that this decoration box wraps. Pass the framework-controlled composable parameter `innerTextField` from the `decorationBox` lambda of the [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| enabled | the enabled state of the text field. When `false`, this decoration box will appear visually disabled. This must be the same value that is passed to [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| singleLine | indicates if this is a single line or multi line text field. This must be the same value that is passed to [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| visualTransformation | transforms the visual representation of the input `value`. This must be the same value that is passed to [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| interactionSource | the read-only [InteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/InteractionSource) representing the stream of [Interaction](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Interaction)s for this text field. You must first create and pass in your own `remember`ed [MutableInteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/MutableInteractionSource) instance to the [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField) for it to dispatch events. And then pass the same instance to this decoration box to observe [Interaction](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Interaction)s and customize the appearance / behavior of this text field in different states. |
| isError | indicates if the text field's current value is in an error state. When `true`, this decoration box will display its contents in an error color. |
| label | the optional label to be displayed inside the text field container. The default text style uses [Typography.caption](/jetpack-compose/androidx.compose.material/material/classes/Typography) when the label is minimized and [Typography.subtitle1](/jetpack-compose/androidx.compose.material/material/classes/Typography) when the label is expanded. |
| placeholder | the optional placeholder to be displayed when the text field is in focus and the input text is empty. The default text style for internal [Text](/jetpack-compose/androidx.compose.material/material/components/Text) is [Typography.subtitle1](/jetpack-compose/androidx.compose.material/material/classes/Typography). |
| leadingIcon | the optional leading icon to be displayed at the beginning of the text field container. |
| trailingIcon | the optional trailing icon to be displayed at the end of the text field container. |
| shape | the shape of the text field's container and border. |
| colors | [TextFieldColors](/jetpack-compose/androidx.compose.material/material/interfaces/TextFieldColors) that will be used to resolve the colors used for this text field decoration box in different states. See [TextFieldDefaults.outlinedTextFieldColors](/jetpack-compose/androidx.compose.material/material/objects/TextFieldDefaults). Note: This parameter only affects the colors of elements in the decoration box. Elements of the [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField) (such as text color or cursor color) are unaffected and must be changed using the relevant parameters of [BasicTextField](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/BasicTextField). |
| border | the border to be drawn around the text field. The cutout to fit the [label](/jetpack-compose/androidx.compose.material3/material3/components/Label) will be automatically added by the framework. Note that by default the color of the border comes from the [colors](/jetpack-compose/androidx.compose.material/material/classes/Colors). |
| contentPadding | the spacing values to apply internally between the internals of text field and the decoration box container. You can use it to implement dense text fields or simply to control horizontal padding. Note that the padding values may not be respected if they are incompatible with the text field's size constraints or layout. See [TextFieldDefaults.outlinedTextFieldPadding](/jetpack-compose/androidx.compose.material/material/objects/TextFieldDefaults). |

<hr class="docs-overload-divider">

<h2 id="textfielddecorationbox-value-innertextfield-enabled-singleline-visualtransformation-interactionsource-iserror-label-placeholder-leadingicon-trailingicon-colors-contentpadding">TextFieldDecorationBox</h2>

```kotlin
@Composable
    @ExperimentalMaterialApi
    fun TextFieldDecorationBox(
        value: String,
        innerTextField: @Composable () -> Unit,
        enabled: Boolean,
        singleLine: Boolean,
        visualTransformation: VisualTransformation,
        interactionSource: InteractionSource,
        isError: Boolean = false,
        label: @Composable (() -> Unit)? = null,
        placeholder: @Composable (() -> Unit)? = null,
        leadingIcon: @Composable (() -> Unit)? = null,
        trailingIcon: @Composable (() -> Unit)? = null,
        colors: TextFieldColors = textFieldColors(),
        contentPadding: PaddingValues =
            if (label == null) {
                textFieldWithoutLabelPadding()
            } else {
                textFieldWithLabelPadding()
            },
    ) =
        TextFieldDecorationBox(
            value = value,
            innerTextField = innerTextField,
            enabled = enabled,
            singleLine = singleLine,
            visualTransformation = visualTransformation,
            interactionSource = interactionSource,
            isError = isError,
            label = label,
            placeholder = placeholder,
            leadingIcon = leadingIcon,
            trailingIcon = trailingIcon,
            shape = TextFieldShape,
            colors = colors,
            contentPadding = contentPadding,
        )
```

<hr class="docs-overload-divider">

<h2 id="outlinedtextfielddecorationbox-value-innertextfield-enabled-singleline-visualtransformation-interactionsource-iserror-label-placeholder-leadingicon-trailingicon-colors-contentpadding-border">OutlinedTextFieldDecorationBox</h2>

```kotlin
@Composable
    @ExperimentalMaterialApi
    fun OutlinedTextFieldDecorationBox(
        value: String,
        innerTextField: @Composable () -> Unit,
        enabled: Boolean,
        singleLine: Boolean,
        visualTransformation: VisualTransformation,
        interactionSource: InteractionSource,
        isError: Boolean = false,
        label: @Composable (() -> Unit)? = null,
        placeholder: @Composable (() -> Unit)? = null,
        leadingIcon: @Composable (() -> Unit)? = null,
        trailingIcon: @Composable (() -> Unit)? = null,
        colors: TextFieldColors = outlinedTextFieldColors(),
        contentPadding: PaddingValues = outlinedTextFieldPadding(),
        border: @Composable () -> Unit = { BorderBox(enabled, isError, interactionSource, colors) },
    ) =
        OutlinedTextFieldDecorationBox(
            value = value,
            innerTextField = innerTextField,
            enabled = enabled,
            singleLine = singleLine,
            visualTransformation = visualTransformation,
            interactionSource = interactionSource,
            isError = isError,
            label = label,
            placeholder = placeholder,
            leadingIcon = leadingIcon,
            trailingIcon = trailingIcon,
            shape = OutlinedTextFieldShape,
            colors = colors,
            contentPadding = contentPadding,
            border = border,
        )
```