NavigableCircuitContent
A composable that provides the core navigation and state management for Circuit-based navigation systems. It manages the rendering of screens from a backstack, handles navigation transitions, and coordinates result passing between screens when navigating backward. This is the primary entry point for creating navigable content surfaces in Circuit.
Features
State Management: Manages saveable and retained state for each screen in the backstack with automatic preservation across configuration changes
Navigation Transitions: Handles animated transitions between screens using NavDecoration or custom AnimatedNavDecorator
Result Handling: Automatically manages screen results when using rememberAnsweringNavigator to pass data back from child screens
Usage
setContent {
val backStack = rememberSaveableBackStack(root = HomeScreen)
val navigator = rememberCircuitNavigator(backStack)
NavigableCircuitContent(navigator, backStack)
}State Management
This creates an isolated retained state registry for the navigation graph to ensure proper state preservation across configuration changes when using rememberRetained. This prevents state loss for off-screen backstack records, even when they're not actively composed. See the implementation comments for technical details.
Parameters
The Navigator used to handle navigation events. Typically created via rememberCircuitNavigator.
The BackStack containing the stack of Records to display. Must have at least one record. Typically created via rememberSaveableBackStack.
The Modifier to apply to the content.
The Circuit instance providing UI factories and configuration. Defaults to LocalCircuit.
Optional map of ProvidedValues to make available to specific records in the backstack. These values will be provided via composition locals when the corresponding record is displayed.
The NavDecoration used to decorate navigation transitions. Defaults to the circuit's default decoration.
Optional AnimatedNavDecorator.Factory to create custom animated transitions. If provided, takes precedence over decoration.
A composable function invoked when a screen cannot be rendered (e.g., no UI factory available). Defaults to the circuit's Circuit.onUnavailableContent.
See also
for requesting results from child screens
for creating a backstack
for creating a navigator
An experimental variant of NavigableCircuitContent that exposes answeringResultHandler for a a AnsweringResultHandler to be provided.
Usage
setContent {
val backStack = rememberSaveableBackStack(root = HomeScreen)
val navigator = rememberCircuitNavigator(backStack)
val answeringResultHandler = rememberAnsweringResultHandler()
NavigableCircuitContent(navigator, backStack, answeringResultHandler)
}