---
title: "withCompositionLocal"
description: "[withCompositionLocal] binds value 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 value provided in [CompositionLocalProvider]'s [value] 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> withCompositionLocal(
    value: ProvidedValue<*>,
    content: @Composable () -> T,
): T
```


`withCompositionLocal` binds value 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 value provided in `CompositionLocalProvider`'s `value` parameter for all composable
functions called directly or indirectly in the `content` lambda.




