{"id":13822044,"url":"https://github.com/olshevski/compose-navigation-reimagined","last_synced_at":"2026-01-11T17:40:28.386Z","repository":{"id":37268514,"uuid":"455126442","full_name":"olshevski/compose-navigation-reimagined","owner":"olshevski","description":"🌈 Type-safe navigation library for Jetpack Compose","archived":false,"fork":false,"pushed_at":"2024-01-27T17:33:17.000Z","size":1347,"stargazers_count":532,"open_issues_count":6,"forks_count":18,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-06-28T03:37:14.996Z","etag":null,"topics":["android","animations","compose","compose-navigation","imagination","jetpack-compose","kotlin","library","lifecycle","navigation","scopes","transitions","type-safety","viewmodel"],"latest_commit_sha":null,"homepage":"https://olshevski.github.io/compose-navigation-reimagined/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olshevski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"olshevski","custom":["www.buymeacoffee.com/olshevski"]}},"created_at":"2022-02-03T10:47:15.000Z","updated_at":"2024-06-27T12:59:57.000Z","dependencies_parsed_at":"2024-01-15T15:46:26.564Z","dependency_job_id":"6e14cdf4-bff6-49d8-ae34-8c6988bff90c","html_url":"https://github.com/olshevski/compose-navigation-reimagined","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olshevski%2Fcompose-navigation-reimagined","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olshevski%2Fcompose-navigation-reimagined/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olshevski%2Fcompose-navigation-reimagined/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olshevski%2Fcompose-navigation-reimagined/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olshevski","download_url":"https://codeload.github.com/olshevski/compose-navigation-reimagined/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213893315,"owners_count":15653524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","animations","compose","compose-navigation","imagination","jetpack-compose","kotlin","library","lifecycle","navigation","scopes","transitions","type-safety","viewmodel"],"created_at":"2024-08-04T08:01:39.581Z","updated_at":"2026-01-11T17:40:28.356Z","avatar_url":"https://github.com/olshevski.png","language":"Kotlin","funding_links":["https://github.com/sponsors/olshevski","www.buymeacoffee.com/olshevski","https://www.buymeacoffee.com/olshevski"],"categories":["Kotlin","Articles"],"sub_categories":["Navigation"],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg width=\"600\" src=\"https://user-images.githubusercontent.com/5606565/234915659-afe98551-5439-4381-aab5-5147fcb8e079.svg\" /\u003e\n\u003c/p\u003e\n\nA small and simple, yet fully fledged and customizable navigation library for [Jetpack Compose](https://developer.android.com/jetpack/compose):\n\n- Full **type-safety**\n- Built-in state restoration\n- Nested navigation with independent backstacks\n- Own Lifecycle, ViewModelStore and SavedStateRegistry for every backstack entry\n- Animated transitions\n- Dialog and bottom sheet navigation\n- Scopes for easier ViewModel sharing \n- No builders, no obligatory superclasses for your composables\n\n## Quick start\n\nAdd a single dependency to your project:\n\n```kotlin\nimplementation(\"dev.olshevski.navigation:reimagined:1.5.0\")\n```\n\nDefine a set of destinations. It is convenient to use a sealed class for this:\n\n```kotlin\nsealed class Destination : Parcelable {\n\n    @Parcelize\n    data object First : Destination()\n\n    @Parcelize\n    data class Second(val id: Int) : Destination()\n\n    @Parcelize\n    data class Third(val text: String) : Destination()\n\n}\n```\n\nCreate a composable with `NavController`, `NavBackHandler` and `NavHost`:\n\n```kotlin\n@Composable\nfun NavHostScreen() {\n    val navController = rememberNavController\u003cDestination\u003e(\n        startDestination = Destination.First\n    )\n\n    NavBackHandler(navController)\n\n    NavHost(navController) { destination -\u003e\n        when (destination) {\n            is Destination.First -\u003e Column {\n                Text(\"First destination\")\n                Button(onClick = {\n                    navController.navigate(Destination.Second(id = 42))\n                }) {\n                    Text(\"Open Second destination\")\n                }\n            }\n\n            is Destination.Second -\u003e Column {\n                Text(\"Second destination: ${destination.id}\")\n                Button(onClick = {\n                    navController.navigate(Destination.Third(text = \"Hello\"))\n                }) {\n                    Text(\"Open Third destination\")\n                }\n            }\n\n            is Destination.Third -\u003e {\n                Text(\"Third destination: ${destination.text}\")\n            }\n        }\n    }\n}\n```\n\nAs you can see, `NavController` is used for switching between destinations, `NavBackHandler` handles back presses and `NavHost` provides a composable corresponding to the last destination in the backstack. As simple as that.\n\n### What about animations?\n\nJust replace `NavHost` with `AnimatedNavHost`. The default transition between destinations is a simple crossfade, but you can customize each transition with the `transitionSpec` parameter:\n\n```kotlin\nAnimatedNavHost(\n    controller = navController,\n    transitionSpec = { action, _, _ -\u003e\n        val direction = if (action == NavAction.Pop) {\n            AnimatedContentTransitionScope.SlideDirection.End\n        } else {\n            AnimatedContentTransitionScope.SlideDirection.Start\n        }\n        slideIntoContainer(direction) togetherWith slideOutOfContainer(direction)\n    }\n) { destination -\u003e\n    // ...\n}\n```\n\n## Documentation\n\nFull documentation is available [here](https://olshevski.github.io/compose-navigation-reimagined).\n\n## Additional dependencies\n\nLibrary-specific `hiltViewModel()` implementation:\n\n```koltin\nimplementation(\"dev.olshevski.navigation:reimagined-hilt:\u003clatest-version\u003e\")\n```\n\n`BottomSheetNavHost` implementation:\n\n```koltin\n// if you are using Material\nimplementation(\"dev.olshevski.navigation:reimagined-material:\u003clatest-version\u003e\")\n\n// if you are using Material 3\nimplementation(\"dev.olshevski.navigation:reimagined-material3:\u003clatest-version\u003e\")\n```\n\n## Sample\n\nExplore the [sample](https://github.com/olshevski/compose-navigation-reimagined/tree/main/sample). It demonstrates:\n\n- passing values and returning results\n- animated transitions\n- dialog and bottom sheet navigation\n- nested navigation\n- [BottomNavigation](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#BottomNavigation(androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,kotlin.Function1)) integration\n- entry-scoped and shared ViewModels\n- hoisting of NavController to the ViewModel layer\n- deeplinks\n\n## About\n\nI've been thinking about Android app architecture and navigation in particular for the longest time. After being introduced to Compose I could finally create the navigation structure that satisfies all my needs perfectly.\n\nI hope it can help you as well.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg width=\"600\" src=\"https://user-images.githubusercontent.com/5606565/227801130-39bee5cf-cf75-47c1-8791-f7753b5c7c0d.svg\" /\u003e\n\u003c/p\u003e\n\n*If you like this library and find it useful, please star the project and share it with your fellow developers. You can also buy me a coffee:*\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://www.buymeacoffee.com/olshevski\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"60px\"\u003e\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folshevski%2Fcompose-navigation-reimagined","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folshevski%2Fcompose-navigation-reimagined","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folshevski%2Fcompose-navigation-reimagined/lists"}