---
title: "LocalGraphicsContext"
description: "The CompositionLocal to provide access to a [GraphicsContext] instance for creation of
[GraphicsLayer]s.

Consumers that access this Local directly and call [GraphicsContext.createGraphicsLayer] are
responsible for calling [GraphicsContext.releaseGraphicsLayer].

It is recommended that consumers invoke [rememberGraphicsLayer][import
androidx.compose.ui.graphics.rememberGraphicsLayer] instead to ensure that a [GraphicsLayer] is
released when the corresponding composable is disposed."
type: "property"
---

<div class='type'>Property</div>


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

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


```kotlin
val LocalGraphicsContext =
staticCompositionLocalOf<GraphicsContext> { noLocalProvidedFor("LocalGraphicsContext") }
```


The CompositionLocal to provide access to a `GraphicsContext` instance for creation of
`GraphicsLayer`s.

Consumers that access this Local directly and call `GraphicsContext.createGraphicsLayer` are
responsible for calling `GraphicsContext.releaseGraphicsLayer`.

It is recommended that consumers invoke `rememberGraphicsLayer` instead to ensure that a `GraphicsLayer` is
released when the corresponding composable is disposed.



