# withCompositionLocals

Common/AllAndroid/JVMNative/C/iOSJavaScript

## Functions summary

|---|---|---|
| `inline T` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable <T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/runtime/withCompositionLocals.composable#withCompositionLocals(kotlin.Array,kotlin.Function0)( vararg values: https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidedValue<*>, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> T )` `https://developer.android.com/reference/kotlin/androidx/compose/runtime/withCompositionLocals.composable#withCompositionLocals(kotlin.Array,kotlin.Function0)` binds values to `https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidableCompositionLocal` key and returns the result produced by the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#withCompositionLocals(kotlin.Array,kotlin.Function0)` lambda. | Cmn |

## Functions

### withCompositionLocals

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

```
@Composable
inline fun <T : Any?> withCompositionLocals(
    vararg values: ProvidedValue<*>,
    content: @Composable () -> T
): T
```

`https://developer.android.com/reference/kotlin/androidx/compose/runtime/withCompositionLocals.composable#withCompositionLocals(kotlin.Array,kotlin.Function0)` binds values to `https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidableCompositionLocal` key and returns the result produced by the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#withCompositionLocals(kotlin.Array,kotlin.Function0)` lambda. Use with non-unit returning `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#withCompositionLocals(kotlin.Array,kotlin.Function0)` lambdas or else use `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalProvider.composable#CompositionLocalProvider(kotlin.Array,kotlin.Function0)`. Reading the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal` using `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal#current()` will return the values provided in `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalProvider.composable#CompositionLocalProvider(kotlin.Array,kotlin.Function0)`'s `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#withCompositionLocals(kotlin.Array,kotlin.Function0)` parameter for all composable functions called directly or indirectly in the `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#withCompositionLocals(kotlin.Array,kotlin.Function0)` lambda.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocalProvider.composable#CompositionLocalProvider(kotlin.Array,kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionLocal` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#compositionLocalOf(androidx.compose.runtime.SnapshotMutationPolicy,kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#staticCompositionLocalOf(kotlin.Function0)` |   |