https://kotlinlang.org logo
Title
t

Todor Grudev

03/10/2022, 7:52 AM
Is there a build in way to achieve this (showing the error under the field, recommended by the material guidelines) with
OutlinedTextField
I did not manage to find one?

https://i.stack.imgur.com/ptvLF.png

p

Peter Suly

03/10/2022, 11:01 AM
I don’t think there is a build in way in Compose, but you can simply create your own composable looking something like this
Column {
    TextField()
    errorText?.let {
      RedText(text = it)
    }
  }
👍 1
t

Todor Grudev

03/10/2022, 11:20 AM
Yeah, that’s how I did it, but it seemed like there should be a build-in way 🙂 Thanks
a

Adam Powell

03/10/2022, 2:33 PM
The compose way is generally to point towards approaches like the above instead of adding many configuration parameters to achieve different built-in variations
t

Todor Grudev

03/10/2022, 2:37 PM
OutlinedTextField
actually accepts a ton of things, and there’s even a parameter which states
isError
so my expectations was that since it tries to follow the material guidelines there would be a way to just pass the message.
👍 1