TextField

fun TextField(state: TextFieldState, modifier: Modifier = Modifier, insideMargin: DpSize = TextFieldDefaults.InsideMargin, backgroundColor: Color = MiuixTheme.colorScheme.secondaryContainer, cornerRadius: Dp = TextFieldDefaults.CornerRadius, label: String = "", labelColor: Color = MiuixTheme.colorScheme.onSecondaryContainer, borderColor: Color = MiuixTheme.colorScheme.primary, useLabelAsPlaceholder: Boolean = false, enabled: Boolean = true, readOnly: Boolean = false, inputTransformation: InputTransformation? = null, textStyle: TextStyle = MiuixTheme.textStyles.main, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, onKeyboardAction: KeyboardActionHandler? = null, lineLimits: TextFieldLineLimits = TextFieldLineLimits.Default, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, onTextLayout: Density.(getResult: () -> TextLayoutResult?) -> Unit? = null, interactionSource: MutableInteractionSource? = null, cursorBrush: Brush = SolidColor(borderColor), outputTransformation: OutputTransformation? = null, scrollState: ScrollState = rememberScrollState())

A TextField component with Miuix style.

Parameters

state

The TextFieldState to be shown in the text field.

modifier

The modifier to be applied to the TextField.

insideMargin

The margin inside the TextField.

backgroundColor

The background color of the TextField.

cornerRadius

The corner radius of the TextField.

label

The label to be displayed when the TextField is empty.

labelColor

The color of the label.

borderColor

The color of the border when the TextField is focused.

useLabelAsPlaceholder

Whether to use the label as a placeholder.

enabled

Whether the TextField is enabled.

readOnly

Whether the TextField is read-only.

inputTransformation

The input transformation to be applied to the TextField.

textStyle

The text style to be applied to the TextField.

keyboardOptions

The keyboard options to be applied to the TextField.

onKeyboardAction

The keyboard action handler for the TextField.

lineLimits

The line limits for the TextField.

leadingIcon

The leading icon to be displayed in the TextField.

trailingIcon

The trailing icon to be displayed in the TextField.

onTextLayout

The callback to be called when the text layout changes.

interactionSource

The interaction source to be applied to the TextField.

cursorBrush

The brush to be used for the cursor.

outputTransformation

The output transformation for the text field.

scrollState

The scroll state for the text field.


fun TextField(value: TextFieldValue, onValueChange: (TextFieldValue) -> Unit, modifier: Modifier = Modifier, insideMargin: DpSize = TextFieldDefaults.InsideMargin, backgroundColor: Color = MiuixTheme.colorScheme.secondaryContainer, cornerRadius: Dp = TextFieldDefaults.CornerRadius, label: String = "", labelColor: Color = MiuixTheme.colorScheme.onSecondaryContainer, borderColor: Color = MiuixTheme.colorScheme.primary, useLabelAsPlaceholder: Boolean = false, enabled: Boolean = true, readOnly: Boolean = false, textStyle: TextStyle = MiuixTheme.textStyles.main, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions.Default, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, singleLine: Boolean = false, maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE, minLines: Int = 1, visualTransformation: VisualTransformation = VisualTransformation.None, onTextLayout: (TextLayoutResult) -> Unit = {}, interactionSource: MutableInteractionSource? = null, cursorBrush: Brush = SolidColor(MiuixTheme.colorScheme.primary))

A TextField component with Miuix style.

Parameters

value

The input TextFieldValue to be shown in the text field.

onValueChange

The callback that is triggered when the input service updates values in TextFieldValue. An updated TextFieldValue comes as a parameter of the callback.

modifier

The modifier to be applied to the TextField.

insideMargin

The margin inside the TextField.

backgroundColor

The background color of the TextField.

cornerRadius

The corner radius of the TextField.

label

The label to be displayed when the TextField is empty.

labelColor

The color of the label.

borderColor

The color of the border when the TextField is focused.

useLabelAsPlaceholder

Whether to use the label as a placeholder.

enabled

Whether the TextField is enabled.

readOnly

Whether the TextField is read-only.

textStyle

The text style to be applied to the TextField.

keyboardOptions

The keyboard options to be applied to the TextField.

keyboardActions

The keyboard actions to be applied to the TextField.

leadingIcon

The leading icon to be displayed in the TextField.

trailingIcon

The trailing icon to be displayed in the TextField.

singleLine

Whether the text field is single line.

maxLines

The maximum number of lines allowed to be displayed in TextField.

minLines

The minimum number of lines allowed to be displayed in TextField. It is required that 1 <= minLines<= maxLines.

visualTransformation

The visual transformation to be applied to the TextField.

onTextLayout

The callback to be called when the text layout changes.

interactionSource

The interaction source to be applied to the TextField.

cursorBrush

The brush to be used for the cursor.


fun TextField(value: String, onValueChange: (String) -> Unit, modifier: Modifier = Modifier, insideMargin: DpSize = TextFieldDefaults.InsideMargin, backgroundColor: Color = MiuixTheme.colorScheme.secondaryContainer, cornerRadius: Dp = TextFieldDefaults.CornerRadius, label: String = "", labelColor: Color = MiuixTheme.colorScheme.onSecondaryContainer, borderColor: Color = MiuixTheme.colorScheme.primary, useLabelAsPlaceholder: Boolean = false, enabled: Boolean = true, readOnly: Boolean = false, textStyle: TextStyle = MiuixTheme.textStyles.main, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions.Default, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, singleLine: Boolean = false, maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE, minLines: Int = 1, visualTransformation: VisualTransformation = VisualTransformation.None, onTextLayout: (TextLayoutResult) -> Unit = {}, interactionSource: MutableInteractionSource? = null, cursorBrush: Brush = SolidColor(MiuixTheme.colorScheme.primary))

A text field component with Miuix style.

Parameters

value

The text to be displayed in the text field.

onValueChange

The callback to be called when the value changes.

modifier

The modifier to be applied to the TextField.

insideMargin

The margin inside the TextField.

backgroundColor

The background color of the TextField.

cornerRadius

The corner radius of the TextField.

label

The label to be displayed when the TextField is empty.

labelColor

The color of the label.

borderColor

The color of the border when the TextField is focused.

useLabelAsPlaceholder

Whether to use the label as a placeholder.

enabled

Whether the TextField is enabled.

readOnly

Whether the TextField is read-only.

textStyle

The text style to be applied to the TextField.

keyboardOptions

The keyboard options to be applied to the TextField.

keyboardActions

The keyboard actions to be applied to the TextField.

leadingIcon

The leading icon to be displayed in the TextField.

trailingIcon

The trailing icon to be displayed in the TextField.

singleLine

Whether the text field is single line.

maxLines

The maximum number of lines allowed to be displayed in TextField.

minLines

The minimum number of lines allowed to be displayed in TextField. It is required that 1 <= minLines<= maxLines.

visualTransformation

The visual transformation to be applied to the TextField.

onTextLayout

The callback to be called when the text layout changes.

interactionSource

The interaction source to be applied to the TextField.

cursorBrush

The brush to be used for the cursor.