NavigableCircuitContent

fun <R : NavStack.Record> NavigableCircuitContent(navigator: Navigator, navStack: NavStack<R>, modifier: Modifier = Modifier, circuit: Circuit = requireNotNull(LocalCircuit.current), providedValues: Map<out NavStack.Record, ProvidedValues> = emptyMap(), decoration: NavDecoration = circuit.defaultNavDecoration, decoratorFactory: AnimatedNavDecorator.Factory? = null, unavailableRoute: @Composable (screen: Screen, modifier: Modifier) -> Unit = circuit.onUnavailableContent)(source)

A composable that provides the core navigation and state management for Circuit-based navigation systems. It manages the rendering of screens from a navstack, 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.

This function automatically wraps your navigator with result handling capabilities via rememberAnsweringResultNavigator, enabling screens to pass results back when using rememberAnsweringNavigator.

Features

  • State Management: Manages saveable and retained state for each screen in the navstack 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 navStack = rememberSaveableNavStack(root = HomeScreen)
val navigator = rememberCircuitNavigator(navStack)
NavigableCircuitContent(navigator, navStack)
}

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 navstack records, even when they're not actively composed. See the implementation comments for technical details.

Parameters

navigator

The Navigator used to handle navigation events. Typically created via rememberCircuitNavigator.

navStack

The NavStack containing the stack of Records to display. Must have at least one record. Typically created via rememberSaveableNavStack.

modifier

The Modifier to apply to the content.

circuit

The Circuit instance providing UI factories and configuration. Defaults to LocalCircuit.

providedValues

Optional map of ProvidedValues to make available to specific records in the navstack. These values will be provided via composition locals when the corresponding record is displayed.

decoration

The NavDecoration used to decorate navigation transitions. Defaults to the circuit's default decoration.

decoratorFactory

Optional AnimatedNavDecorator.Factory to create custom animated transitions. If provided, takes precedence over decoration.

unavailableRoute

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 the underlying result navigator creation

for creating a navstack

for creating a navigator


fun <R : BackStack.Record> NavigableCircuitContent(navigator: Navigator, backStack: BackStack<R>, modifier: Modifier = Modifier, circuit: Circuit = requireNotNull(LocalCircuit.current), providedValues: Map<out NavStack.Record, ProvidedValues> = emptyMap(), decoration: NavDecoration = circuit.defaultNavDecoration, decoratorFactory: AnimatedNavDecorator.Factory? = null, unavailableRoute: @Composable (screen: Screen, modifier: Modifier) -> Unit = circuit.onUnavailableContent)(source)

A legacy variant of NavigableCircuitContent that takes a Navigator and a BackStack.

See also

for the standard overload that takes a Navigator and NavStack.


fun <R : NavStack.Record> NavigableCircuitContent(navigator: AnsweringResultNavigator<R>, modifier: Modifier = Modifier, circuit: Circuit = requireNotNull(LocalCircuit.current), providedValues: Map<out NavStack.Record, ProvidedValues> = emptyMap(), decoration: NavDecoration = circuit.defaultNavDecoration, decoratorFactory: AnimatedNavDecorator.Factory? = null, unavailableRoute: @Composable (screen: Screen, modifier: Modifier) -> Unit = circuit.onUnavailableContent)(source)

An experimental variant of NavigableCircuitContent that takes an AnsweringResultNavigator directly, which combines navigation and result handling into a single object.

This variant is useful when you need direct access to the AnsweringResultNavigator instance, such as when passing the navigator to nested components, managing multiple navigation graphs with shared result handling, or when you need custom control over the result handler lifecycle.

For most use cases, prefer the standard NavigableCircuitContent overload that takes a Navigator and NavStack, as it automatically creates and manages the result navigator.

Usage

setContent {
val navStack = rememberSaveableNavStack(root = HomeScreen)
val baseNavigator = rememberCircuitNavigator(navStack)
val navigator = rememberAnsweringResultNavigator(baseNavigator, navStack)
NavigableCircuitContent(navigator)
}

Parameters

navigator

The AnsweringResultNavigator that handles both navigation and results.

modifier

The Modifier to apply to the content.

circuit

The Circuit instance providing UI factories and configuration.

providedValues

Optional map of ProvidedValues to make available to specific records.

decoration

The NavDecoration used to decorate navigation transitions.

decoratorFactory

Optional AnimatedNavDecorator.Factory to create custom animated transitions.

unavailableRoute

A composable function invoked when a screen cannot be rendered.

See also

for the navigator that combines navigation and result handling

for creating an answering result navigator