Search code examples
androidkotlinandroid-jetpack-compose

How to set the color of drag section of ModalBottomSheet in Jetpack Compose


That section where the handle is placed is colored in white, how can I change the color of that part of the bottom sheet. I don't want to change the whole container color, because I have some content below which has it own color and it would look bad.

Currently it looks like this

This is what I want it to be


Solution

  • The ModalBottomSheet composable has a parameter called containerColor that sets the color for the entire container. You can use this parameter to achieve your desired color. If you want two different colors for the handle region and content region, you can set the containerColor param for the handle region background and use a different color as the background for the content composable.