Skip to content

A library which provides Compose Material3 support for Jetpack Navigation Compose. This features composable bottom sheet destinations.

License

Notifications You must be signed in to change notification settings

eygraber/compose-material3-navigation

Repository files navigation

Compose Material3 Navigation

A library which provides Compose Material3 support for Jetpack Navigation Compose. This features composable bottom sheet destinations.

Usage

Bottom Sheet Destinations

  1. Create a ModalBottomSheetNavigator and add it to the NavController:
@Composable
fun MyApp() {
    val bottomSheetNavigator = rememberModalBottomSheetNavigator()
    val navController = rememberNavController(bottomSheetNavigator)
}
  1. 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") {
           // We'll define our graph here in a bit!
        }
    }
}
  1. 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.7")
}

Snapshots can be found here.

About

A library which provides Compose Material3 support for Jetpack Navigation Compose. This features composable bottom sheet destinations.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •