# ProvideActionInterceptor

## 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/a2ui/compose/runtime/A2uiComponentScope.https://developer.android.com/reference/kotlin/androidx/a2ui/compose/runtime/ProvideActionInterceptor.composable#(androidx.a2ui.compose.runtime.A2uiComponentScope).ProvideActionInterceptor(kotlin.Function1,kotlin.Function0)( onIntercept: (actionPayload: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Intercepts actions dispatched by descendant components within `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/runtime/package-summary#(androidx.a2ui.compose.runtime.A2uiComponentScope).ProvideActionInterceptor(kotlin.Function1,kotlin.Function0)`. |

## Functions

### A2uiComponentScope.ProvideActionInterceptor

Artifact: [androidx.a2ui.compose:compose-runtime](https://developer.android.com/jetpack/androidx/releases/a2ui-compose) [View Source](https://cs.android.com/search?q=file:androidx/a2ui/compose/runtime/A2uiComponentScope.kt+function:ProvideActionInterceptor)

```
@Composable
fun A2uiComponentScope.ProvideActionInterceptor(
    onIntercept: (actionPayload: Map<String, Any?>) -> Boolean,
    content: @Composable () -> Unit
): Unit
```

Intercepts actions dispatched by descendant components within `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/runtime/package-summary#(androidx.a2ui.compose.runtime.A2uiComponentScope).ProvideActionInterceptor(kotlin.Function1,kotlin.Function0)`.

Useful for container components (such as modals) that handle actions from child triggers (like buttons or cards) to update local UI state instead of dispatching to the surface.

### Interceptor Chaining

Interceptors chain from the innermost (deepest child) to the outermost (ancestor) in the composition tree:

- If `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/runtime/package-summary#(androidx.a2ui.compose.runtime.A2uiComponentScope).ProvideActionInterceptor(kotlin.Function1,kotlin.Function0)` returns `true`, the action is consumed immediately; outer interceptors and the underlying surface will not receive the action.

- If `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/runtime/package-summary#(androidx.a2ui.compose.runtime.A2uiComponentScope).ProvideActionInterceptor(kotlin.Function1,kotlin.Function0)` returns `false`, the action falls back to the parent interceptor.

- If all chained interceptors return `false`, the action dispatches to the surface.

| Parameters |
|---|---|
| `onIntercept: (actionPayload: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | The callback invoked when a descendant dispatches an action. Return `true` to consume the action, or `false` to pass it to parent interceptors or the surface. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The composable content to apply the interceptor to |