@@ -21,6 +21,10 @@ import com.varabyte.kobweb.compose.ui.attrsModifier
2121import org.jetbrains.compose.web.attributes.AttrsScope
2222import org.w3c.dom.HTMLElement
2323
24+ private fun inputType (singleLine : Boolean , lines : Int ) =
25+ // This is consistent with the `androidx.compose.material3` text field behavior.
26+ if (singleLine || lines == 1 ) null else TextareaInputType
27+
2428private fun Modifier.toTextFieldAttrs (
2529 onValueChange : (String ) -> Unit , keyboardOptions : KeyboardOptions , keyboardActions : KeyboardActions ,
2630): AttrsScope <HTMLElement >.() -> Unit =
@@ -83,6 +87,7 @@ actual fun TextField(
8387 rows = if (singleLine) null else lines,
8488 placeholder = placeholder,
8589 readOnly = readOnly.isTrueOrNull(),
90+ type = inputType(singleLine, lines),
8691
8792 attrs = modifier.toTextFieldAttrs(onValueChange, keyboardOptions, keyboardActions),
8893 content = TextFieldContent (value, leadingIcon, trailingIcon)
@@ -123,7 +128,7 @@ actual fun OutlinedTextField(
123128 rows = if (singleLine) null else lines,
124129 placeholder = placeholder,
125130 readOnly = readOnly.isTrueOrNull(),
126- type = if (singleLine) null else TextareaInputType ,
131+ type = inputType (singleLine, lines) ,
127132
128133 attrs = modifier.toTextFieldAttrs(onValueChange, keyboardOptions, keyboardActions),
129134 content = TextFieldContent (value, leadingIcon, trailingIcon)
0 commit comments