Modo - State-Based Jetpack Compose Navigation
Modo is a simple and convenient state-based navigation library for Jetpack Compose.
Modo.overview.mp4
Check out our website to get the most up-to-date information about the library:
Each integration of Modo is a rooted tree (wiki) that can be displayed as follows:
- Each node is a
Screen
orContainerScreen
. - Leaf nodes are
Screen
s. - Inner nodes are
ContainerScreen
s. They can contain otherScreen
s orContainerScreen
s in theirnavigationState
. - The root node is a
RootScreen
. You can have multiple roots in your app. See How to integrate Modo for details.
NavigationState
defines the UI:- The initial state is defined in the constructor of
ContainerScreen
bynavModel: NavModel<State, Action>
. - To update the state, use
dispatch(action: Action)
onNavigationContainer
, or use the built-in extension functions for StackScreen and MultiScreen.
- The initial state is defined in the constructor of
- There are
Screen
andContainerScreen
:ContainerScreen
can contain and render child screens.- There are some built-in implementations of
ContainerScreen
likeStackScreen
andMultiScreen
.
- You can easily create custom
Action
by extendingAction
orReducerAction
.
MIT License
Copyright (c) Konstantin Tskhovrebov (@terrakok)
and Karenkov Igor (@KarenkovID)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.