androidkotlingradleandroid-jetpack-composejetpack-compose-modalbottomsheet

Can't find ModalBottomSheet in jetpack compose


I am trying to implement a simple ModalBottomSheet in material 3 Jetpack compose however I cannot find it

I tried to first simply create the composable, and when that gave an error I also tried to force it import the composable

import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Modifier
import androidx.compose.material3.ModalBottomSheet //This is not a recognized import

@Composable
fun SelectedContactSheet(
    visible: MutableState<Boolean>,
    modifier: Modifier = Modifier
) {
    ModalBottomSheet(){} // This is not a recognized composable
}

Solution

  • ModalBottomSheet is available at androidx.compose.material3

    Please check if you have implemented the correct library.

    dependencies {
        implementation("androidx.compose.material3:material3:1.1.1")
    }