androidx.compose.material3

OutlinedTextFieldDefaults

Object

No hand-written docs yet.

Contains the default values used by OutlinedTextField. For defaults used in TextField, see TextFieldDefaults.

object OutlinedTextFieldDefaults

Properties

shape

@Composable val shape: Shape

Default shape for an OutlinedTextField.

roundedShapeSince 1.12

@Composable val roundedShape: Shape

A rounded shape for an OutlinedTextField, as recommended by Expressive style.

MinHeight

val MinHeight: Dp

The default min height applied to an OutlinedTextField. Note that you can override it by applying Modifier.heightIn directly on a text field.

MinWidth

val MinWidth: Dp

The default min width applied to an OutlinedTextField. Note that you can override it by applying Modifier.widthIn directly on a text field.

UnfocusedBorderThickness

val UnfocusedBorderThickness: Dp

The default thickness of the border in OutlinedTextField in unfocused state.

FocusedBorderThickness

val FocusedBorderThickness: Dp

The default thickness of the border in OutlinedTextField in focused state.

Functions

decoratorSince 1.9

@Composable
fun decorator(
    state: TextFieldState,
    enabled: Boolean,
    lineLimits: TextFieldLineLimits,
    outputTransformation: OutputTransformation?,
    interactionSource: InteractionSource,
    labelPosition: TextFieldLabelPosition = TextFieldLabelPosition.Cutout(),
    label: @Composable (TextFieldLabelScope.() -> Unit)? = null,
    placeholder: @Composable (() -> Unit)? = null,
    leadingIcon: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    prefix: @Composable (() -> Unit)? = null,
    suffix: @Composable (() -> Unit)? = null,
    supportingText: @Composable (() -> Unit)? = null,
    isError: Boolean = false,
    colors: TextFieldColors = colors(),
    contentPadding: PaddingValues = defaultContentPadding(label, labelPosition),
    container: @Composable () -> Unit = { Container(enabled = enabled, isError = isError, interactionSource = interactionSource, colors = colors, shape = shape, focusedBorderThickness = FocusedBorderThickness, unfocusedBorderThickness = UnfocusedBorderThickness) },
): TextFieldDecorator

A decorator used to create custom text fields based on Material Design outlined text field.

Container

@Composable
fun Container(
    enabled: Boolean,
    isError: Boolean,
    interactionSource: InteractionSource,
    modifier: Modifier = Modifier,
    colors: TextFieldColors = colors(),
    shape: Shape = OutlinedTextFieldDefaults.shape,
    focusedBorderThickness: Dp = FocusedBorderThickness,
    unfocusedBorderThickness: Dp = UnfocusedBorderThickness,
)

Composable that draws a default container for an OutlinedTextField with a border stroke. You can apply it to a BasicTextField using decorator or DecorationBox to create a custom text field based on the styling of a Material outlined text field. The OutlinedTextField component applies it automatically.

DecorationBox

@Composable
fun DecorationBox(
    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,
    prefix: @Composable (() -> Unit)? = null,
    suffix: @Composable (() -> Unit)? = null,
    supportingText: @Composable (() -> Unit)? = null,
    colors: TextFieldColors = colors(),
    contentPadding: PaddingValues = contentPaddingWithoutLabel(),
    container: @Composable () -> Unit = { Container(enabled = enabled, isError = isError, interactionSource = interactionSource, modifier = Modifier, colors = colors, shape = shape, focusedBorderThickness = FocusedBorderThickness, unfocusedBorderThickness = UnfocusedBorderThickness) },
)

A decoration box used to create custom text fields based on Material Design outlined text field.

contentPaddingWithLabelSince 1.12

fun contentPaddingWithLabel(
    start: Dp = TextFieldPadding,
    top: Dp = TextFieldWithLabelVerticalPadding,
    end: Dp = TextFieldPadding,
    bottom: Dp = TextFieldWithLabelVerticalPadding,
): PaddingValues

Default content padding of the input field within the OutlinedTextField when there is an inside label. Note that the top padding represents the padding above the label in the focused state. The input field is placed directly beneath the label.

contentPaddingWithoutLabelSince 1.12

fun contentPaddingWithoutLabel(
    start: Dp = TextFieldPadding,
    top: Dp = TextFieldPadding,
    end: Dp = TextFieldPadding,
    bottom: Dp = TextFieldPadding,
): PaddingValues

Default content padding of the input field within the OutlinedTextField when the label is absent or not positioned inside the container.

colors

@Composable
fun colors(): TextFieldColors

Creates a TextFieldColors that represents the default input text, container, and content colors (including label, placeholder, icons, etc.) used in an OutlinedTextField.

tonalColorsSince 1.12

@Composable
fun tonalColors(): TextFieldColors

Creates a TextFieldColors that represents the Expressive style input text, container, and content colors (including label, placeholder, icons, etc.) used in an OutlinedTextField with tonal colors.

@Composable
fun colors(
    focusedTextColor: Color = Color.Unspecified,
    unfocusedTextColor: Color = Color.Unspecified,
    disabledTextColor: Color = Color.Unspecified,
    errorTextColor: Color = Color.Unspecified,
    focusedContainerColor: Color = Color.Unspecified,
    unfocusedContainerColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    errorContainerColor: Color = Color.Unspecified,
    cursorColor: Color = Color.Unspecified,
    errorCursorColor: Color = Color.Unspecified,
    selectionColors: TextSelectionColors? = null,
    focusedBorderColor: Color = Color.Unspecified,
    unfocusedBorderColor: Color = Color.Unspecified,
    disabledBorderColor: Color = Color.Unspecified,
    errorBorderColor: Color = Color.Unspecified,
    focusedLeadingIconColor: Color = Color.Unspecified,
    unfocusedLeadingIconColor: Color = Color.Unspecified,
    disabledLeadingIconColor: Color = Color.Unspecified,
    errorLeadingIconColor: Color = Color.Unspecified,
    focusedTrailingIconColor: Color = Color.Unspecified,
    unfocusedTrailingIconColor: Color = Color.Unspecified,
    disabledTrailingIconColor: Color = Color.Unspecified,
    errorTrailingIconColor: Color = Color.Unspecified,
    focusedLabelColor: Color = Color.Unspecified,
    unfocusedLabelColor: Color = Color.Unspecified,
    disabledLabelColor: Color = Color.Unspecified,
    errorLabelColor: Color = Color.Unspecified,
    focusedPlaceholderColor: Color = Color.Unspecified,
    unfocusedPlaceholderColor: Color = Color.Unspecified,
    disabledPlaceholderColor: Color = Color.Unspecified,
    errorPlaceholderColor: Color = Color.Unspecified,
    focusedSupportingTextColor: Color = Color.Unspecified,
    unfocusedSupportingTextColor: Color = Color.Unspecified,
    disabledSupportingTextColor: Color = Color.Unspecified,
    errorSupportingTextColor: Color = Color.Unspecified,
    focusedPrefixColor: Color = Color.Unspecified,
    unfocusedPrefixColor: Color = Color.Unspecified,
    disabledPrefixColor: Color = Color.Unspecified,
    errorPrefixColor: Color = Color.Unspecified,
    focusedSuffixColor: Color = Color.Unspecified,
    unfocusedSuffixColor: Color = Color.Unspecified,
    disabledSuffixColor: Color = Color.Unspecified,
    errorSuffixColor: Color = Color.Unspecified,
): TextFieldColors

Creates a TextFieldColors that represents the default input text, container, and content colors (including label, placeholder, icons, etc.) used in an OutlinedTextField.

Library docs

Contains the default values used by OutlinedTextField. For defaults used in TextField, see TextFieldDefaults.