androidandroid-jetpack-composeandroid-jetpack-compose-material3material3

Jetpack Compose - Reduce Material3 TopAppBar Height


I am migrating my code from Material2 to Material3. The TopAppBar in Material3 has a larger height than Material2, which is not what I want. I have tried reducing the height using the following without success:

I cannot duplicate and modify the source code because there are too many internal functions and classes for it to be feasible.


Solution

  • This will reduce the height to the original material design height and the text inside the bar will remain vertically centered:

    TopAppBar(
        // required parameters,
        modifier = Modifier.heightIn(max = 56.dp),
    )