---
title: "StyleStateScope"
description: "An interface that introduces the state property to a Style receiver scope."
type: "interface"
lastmod: "2026-05-20T01:13:53.385009Z"
---
## API Reference

> Source set: Common

```kotlin
@ExperimentalFoundationStyleApi
interface StyleStateScope
```

An interface that introduces the [state](/jetpack-compose/androidx.compose.foundation/foundation/functions/state) property to a [Style](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Style) receiver scope.

## Properties

### state

> Source set: Common

```kotlin
val state: StyleState
```

The state of the component. applying this style. For example, if a component is pressed the
[StyleState.isPressed](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleState) will be `true`.

Custom states can be read from the state using the [StyleStateKey](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleStateKey) for the state.

## Functions

### state

```kotlin
fun <T> state(
        key: StyleStateKey<T>,
        block: () -> Unit,
        active: (key: StyleStateKey<T>, state: StyleState) -> Boolean,
    )
```

A helper function to implement state reading extension functions such as
[StyleScope.pressed](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/StyleScope).

Custom style states can use this function to implement start reading functions to be
consistent with the predefined state reading functions.

#### Parameters

| | |
| --- | --- |
| key | the [StyleStateKey](/jetpack-compose/androidx.compose.foundation/foundation/classes/StyleStateKey) for the custom state. |
| block | the block to execute when `active` returns `true`. |
| active | an expression that should return `true` when the state is active and `block` should be called. |
