# NavigationBackHandler

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/navigationevent/compose/NavigationBackHandler.composable#NavigationBackHandler(androidx.navigationevent.compose.NavigationEventState,kotlin.Boolean,kotlin.Function0,kotlin.Function0)( state: https://developer.android.com/reference/kotlin/androidx/navigationevent/compose/NavigationEventState<https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInfo>, isBackEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, onBackCancelled: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onBackCompleted: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` A composable that handles only back navigation gestures, driven by a manually hoisted `https://developer.android.com/reference/kotlin/androidx/navigationevent/compose/NavigationEventState`. | Cmn |

## Functions

### NavigationBackHandler

Cmn Artifact: [androidx.navigationevent:navigationevent-compose](https://developer.android.com/jetpack/androidx/releases/navigationevent) [View Source](https://cs.android.com/search?q=file:androidx/navigationevent/compose/NavigationEventHandler.kt+function:NavigationBackHandler) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
@Composable
fun NavigationBackHandler(
    state: NavigationEventState<NavigationEventInfo>,
    isBackEnabled: Boolean = true,
    onBackCancelled: () -> Unit = {},
    onBackCompleted: () -> Unit
): Unit
```

A composable that handles only back navigation gestures, driven by a manually hoisted `https://developer.android.com/reference/kotlin/androidx/navigationevent/compose/NavigationEventState`.

This is a convenience wrapper around the core `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHandler` overload for cases where forward navigation is not relevant. Use this overload when hoisting state (e.g., for custom animations).

Refer to the primary `https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventHandler` KDoc for details on precedence, unconditional usage, and timing considerations.

| Parameters |
|---|---|
| `state: https://developer.android.com/reference/kotlin/androidx/navigationevent/compose/NavigationEventState<https://developer.android.com/reference/kotlin/androidx/navigationevent/NavigationEventInfo>` | The hoisted `https://developer.android.com/reference/kotlin/androidx/navigationevent/compose/NavigationEventState` (returned from `https://developer.android.com/reference/kotlin/androidx/navigationevent/compose/rememberNavigationEventState.composable#rememberNavigationEventState(androidx.navigationevent.NavigationEventInfo,kotlin.collections.List,kotlin.collections.List)`) to be registered. |
| `isBackEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Controls whether back navigation gestures are handled. |
| `onBackCancelled: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html = {}` | Called if a back navigation gesture is cancelled. |
| `onBackCompleted: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Called when a back navigation gesture completes and navigation occurs. |