How do I add an elevation drop shadow to the SmallTopAppBar
in Material3? With the TopAppBar
in Material2, you simply had to specify the elevation
parameter, but how do you do it with Material3?
Asked
Active
Viewed 277 times
0

Raj Narayanan
- 2,443
- 4
- 24
- 43
2 Answers
1
The M3 toolbars no longer use a shadow to elevate themselves. In M3 the color changes as you scroll to differentiate the toolbar from the rest of the content.
There is a sample available in the docs

Ben Trengrove
- 8,191
- 3
- 40
- 58
-
Can you specify a border for the `SmallTopAppBar` in M3? – Raj Narayanan Aug 30 '22 at 04:56
-
I assume Modifier.border() works but I haven't tried – Ben Trengrove Aug 30 '22 at 04:59
1
Working with jetpack compose you typically have 3 options for shadow elevation:
- The composable itself has a shadow elevation (Material3 uses color as mentioned by Ben)
- The use of Modifier.shadow(elevation = X.dp)
- Wrapping whatever is needed in a Surface composable which will give you most of the UI freedom needed (Though at this point might as well make a custom element yourself)
Hope I was able to help!

Arthur Kasparian
- 486
- 2
- 12