Compose Material3 Navigation
A library which provides Compose Material3
support for Jetpack Navigation Compose.
This features composable bottom sheet destinations.
Usage
Bottom Sheet Destinations
- Create a
ModalBottomSheetNavigator and add it to the NavController:
@Composable
fun MyApp() {
val bottomSheetNavigator = rememberModalBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
}
- Wrap your
NavHost in the ModalBottomSheetLayout composable that accepts a ModalBottomSheetNavigator.
@Composable
fun MyApp() {
val bottomSheetNavigator = rememberModalBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, "home") {
}
}
}
- Register a bottom sheet destination
@Composable
fun MyApp() {
val bottomSheetNavigator = rememberModalBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, "home") {
composable(route = "home") {
...
}
bottomSheet(route = "sheet") {
Text("This is a cool bottom sheet!")
}
}
}
}
Setup
repositories {
mavenCentral()
}
dependencies {
implementation("com.eygraber:compose-material3-navigation:0.0.8")
}
Snapshots can be found here.