---
title: "StyleResolver"
description: "A resolver that will resolve the properties of a given style lambda."
type: "class"
lastmod: "2026-09-24"
---
## API Reference

> Source set: Common

```kotlin
public class StyleResolver(
    internal val style: CommonStyle,
    internal val styleState: StyleState = MutableStyleState(null),
) : RememberObserver
```

A resolver that will resolve the properties of a given style lambda. An instance of this should
be created and passed to the [styleResolver](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/styleResolver/api) modifier which will resolve the style lambda in
context.

#### Parameters

| | |
| --- | --- |
| style | a [CommonStyle](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/CommonStyle) that will be invoked to resolve the style properties. [CustomStyle](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/CustomStyle) types should provide a `toCommonStyle()` extension method that converts the custom style to [CommonStyle](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/CommonStyle) to be passed as the value of the [style](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Style) parameter. |
| styleState | a [StyleState](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleState) instance that is provided to the [StyleStateScope](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/StyleStateScope) as the [StyleStateScope.state](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/StyleStateScope) parameter. This allows the [style](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Style) to read the [styleState](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleState) during resolution to detect, for example, when the component being styled is focused, pressed, hovered, etc. in addition to custom states such as `isPlaying`. |

## Functions

### resolve

> Source set: Common

```kotlin
public inline fun <R> resolve(block: StyleResolverScope.() -> R): R
```

Asks the [StyleResolver](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleResolver/api) to resolve the properties of a given style lambda. The resolved
properties can be read in `block`.

#### Parameters

| | |
| --- | --- |
| block | called in a scope that allows style properties to be read. |

### onRemembered

> Source set: Common

```kotlin
override fun onRemembered()
```

Implements `RememberObserver` API to allow composition to manage the lifetime of the
[StyleResolver](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleResolver/api)

### onForgotten

> Source set: Common

```kotlin
override fun onForgotten()
```

Implements `RememberObserver` API to allow composition to manage the lifetime of the
[StyleResolver](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleResolver/api)

### onAbandoned

> Source set: Common

```kotlin
override fun onAbandoned()
```

Implements `RememberObserver` API to allow composition to manage the lifetime of the
[StyleResolver](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleResolver/api)
