Skip to content

Latest commit

 

History

History
63 lines (55 loc) · 1.76 KB

File metadata and controls

63 lines (55 loc) · 1.76 KB

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.8")
}

Snapshots can be found here.