Question: How can I get a "only enter numbers" `Te...
# compose-desktop
u
Question: How can I get a "only enter numbers"
TextField
?
a
Hey, i did it like this. (not sure if the keyboard-type makes a big difference)
Copy code
TextField(
    value = weeklyHours,
    label = { Text("Weekly hours") },
    onValueChange = { value -> weeklyHours = value.filter { it.isDigit() } },
    keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number)
)
u
Thanks!
592 Views