TextFieldDefaults

@Immutable
object TextFieldDefaults

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

Properties

Link copied to clipboard
@get:Composable
val filledShape: Shape
Link copied to clipboard
Link copied to clipboard

The default thickness of the indicator line in TextField in focused state.

Link copied to clipboard
val MinHeight: Dp

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

Link copied to clipboard
val MinWidth: Dp

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

Link copied to clipboard
@get:Composable
val outlinedShape: Shape
Link copied to clipboard
@get:Composable
val shape: Shape

Default shape for a TextField.

Link copied to clipboard
Link copied to clipboard

The default thickness of the indicator line in TextField in unfocused state.

Functions

Link copied to clipboard
@Composable
fun colors(): TextFieldColors
@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, focusedIndicatorColor: Color = Color.Unspecified, unfocusedIndicatorColor: Color = Color.Unspecified, disabledIndicatorColor: Color = Color.Unspecified, errorIndicatorColor: 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 a TextField.

Link copied to clipboard
@Composable
fun Container(enabled: Boolean, isError: Boolean, interactionSource: InteractionSource, modifier: Modifier = Modifier, colors: TextFieldColors = colors(), shape: Shape = TextFieldDefaults.shape, focusedIndicatorLineThickness: Dp = FocusedIndicatorThickness, unfocusedIndicatorLineThickness: Dp = UnfocusedIndicatorThickness)

Composable that draws a default container for a TextField with an indicator line at the bottom. You can apply it to a BasicTextField using decorator or DecorationBox to create a custom text field based on the styling of a Material filled text field. The TextField component applies it automatically.

Link copied to clipboard
@Composable
fun ContainerBox(enabled: Boolean, isError: Boolean, interactionSource: InteractionSource, colors: TextFieldColors, shape: Shape = TextFieldDefaults.shape)
Link copied to clipboard
fun contentPaddingWithLabel(start: Dp = TextFieldPadding, end: Dp = TextFieldPadding, top: Dp = TextFieldWithLabelVerticalPadding, bottom: Dp = TextFieldWithLabelVerticalPadding): PaddingValues

Default content padding of the input field within the TextField 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.

Link copied to clipboard
fun contentPaddingWithoutLabel(start: Dp = TextFieldPadding, top: Dp = TextFieldPadding, end: Dp = TextFieldPadding, bottom: Dp = TextFieldPadding): PaddingValues

Default content padding of the input field within the TextField when the label is null or positioned TextFieldLabelPosition.Above.

Link copied to clipboard
@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, shape: Shape = TextFieldDefaults.shape, colors: TextFieldColors = colors(), contentPadding: PaddingValues = if (label == null) { contentPaddingWithoutLabel() } else { contentPaddingWithLabel() }, container: @Composable () -> Unit = { Container( enabled = enabled, isError = isError, interactionSource = interactionSource, modifier = Modifier, colors = colors, shape = shape, focusedIndicatorLineThickness = FocusedIndicatorThickness, unfocusedIndicatorLineThickness = UnfocusedIndicatorThickness, ) })

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

Link copied to clipboard
@Composable
fun decorator(state: TextFieldState, enabled: Boolean, lineLimits: TextFieldLineLimits, outputTransformation: OutputTransformation?, interactionSource: InteractionSource, labelPosition: TextFieldLabelPosition = TextFieldLabelPosition.Attached(), 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 = if (label == null || labelPosition is TextFieldLabelPosition.Above) { contentPaddingWithoutLabel() } else { contentPaddingWithLabel() }, container: @Composable () -> Unit = { Container( enabled = enabled, isError = isError, interactionSource = interactionSource, colors = colors, shape = shape, focusedIndicatorLineThickness = FocusedIndicatorThickness, unfocusedIndicatorLineThickness = UnfocusedIndicatorThickness, ) }): TextFieldDecorator

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

Link copied to clipboard
fun Modifier.indicatorLine(enabled: Boolean, isError: Boolean, interactionSource: InteractionSource, colors: TextFieldColors? = null, textFieldShape: Shape? = null, focusedIndicatorLineThickness: Dp = FocusedIndicatorThickness, unfocusedIndicatorLineThickness: Dp = UnfocusedIndicatorThickness): Modifier

A modifier to draw a default bottom indicator line for TextField. You can apply it to a BasicTextField to create a custom text field based on the styling of a Material filled text field.

Link copied to clipboard
fun outlinedTextFieldPadding(start: Dp = TextFieldPadding, top: Dp = TextFieldPadding, end: Dp = TextFieldPadding, bottom: Dp = TextFieldPadding): PaddingValues
Link copied to clipboard
fun textFieldWithLabelPadding(start: Dp = TextFieldPadding, end: Dp = TextFieldPadding, top: Dp = TextFieldWithLabelVerticalPadding, bottom: Dp = TextFieldWithLabelVerticalPadding): PaddingValues
Link copied to clipboard
fun textFieldWithoutLabelPadding(start: Dp = TextFieldPadding, top: Dp = TextFieldPadding, end: Dp = TextFieldPadding, bottom: Dp = TextFieldPadding): PaddingValues