Is there any out of the box solution for limiting the character size in TextField's ? I don't see any maxLength parameter like we had in XML.
Is there any out of the box solution for limiting the character size in TextField's ? I don't see any maxLength parameter like we had in XML.
With 1.x.y
there isn't a built-in parameter.
You can use something like:
var text by remember { mutableStateOf(TextFieldValue("")) }
val maxChar = 5
TextField(
singleLine = true,
value = text,
onValueChange = {
if (it.length <= maxChar) text = it
}
)