https://kotlinlang.org logo
#compose-android
Title
# compose-android
j

Jonathan

02/27/2024, 3:58 PM
Does anyone know how to disable the label animation of TextField when the value is empty? I’d like for the Label to be top-aligned at all times and not only where there is text present.
s

Stylianos Gakis

02/27/2024, 4:32 PM
Doubt that’s customizable on the m3 component there. Just look inside the source code of it and see for yourself too to make sure.
j

Jonathan

02/27/2024, 4:33 PM
I’ve taken a look but wanted to make sure I didn’t miss anything.
s

Stylianos Gakis

02/27/2024, 4:35 PM
Yeah, don’t think so from last time I checked there. Might have to copy-paste the entire component if you want to customize that. Otherwise you can kinda hack it by always displaying a whitespace ” ” when your state is actually just an empty string, but that is absolutely a hack that you might regret in the future for various reasons 😄
👍 1
c

Chris Sinco [G]

02/29/2024, 5:47 AM
Yeah that is the design spec for Material3 TextField. To fully customize, you can replicate parts of it with BasicTextField and custom decorator box
1
5 Views