---
title: "withCompositionLocals"
description: "[withCompositionLocals] binds values to [ProvidableCompositionLocal] key and returns the result
produced by the [content] lambda. Use with non-unit returning [content] lambdas or else use
[CompositionLocalProvider]. Reading the [CompositionLocal] using [CompositionLocal.current] will
return the values provided in [CompositionLocalProvider]'s [values] parameter for all composable
functions called directly or indirectly in the [content] lambda."
type: "composable"
---

<div class='type'>Composable Function</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


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


`withCompositionLocals` binds values to `ProvidableCompositionLocal` key and returns the result
produced by the `content` lambda. Use with non-unit returning `content` lambdas or else use
`CompositionLocalProvider`. Reading the `CompositionLocal` using `CompositionLocal.current` will
return the values provided in `CompositionLocalProvider`'s `values` parameter for all composable
functions called directly or indirectly in the `content` lambda.




