In my case setting windowInsets
to zero wasn't enough. There was still top padding applied by the SearchBar itself. So I used Modifier.windowInsetsTopHeight(WindowInsets(0.dp))
and the trick was done. This case happens not only for the Text component, but also for others.