---
title: "rememberUpdatedStyleState"
description: "Create, remember and update a [StyleState] for use as a parameter of a
[androidx.compose.ui.Modifier.styleable] modifier."
type: "composable"
---

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


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

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


```kotlin
@ExperimentalFoundationStyleApi
@Composable
inline fun rememberUpdatedStyleState(
    interactionSource: InteractionSource?,
    block: @Composable (MutableStyleState) -> Unit = {},
): StyleState
```


Create, remember and update a `StyleState` for use as a parameter of a
`androidx.compose.ui.Modifier.styleable` modifier.

#### Parameters

| | |
| --- | --- |
| interactionSource | the interaction source to observe for the style state. |
| block | a lambda that will initializes or updates the style state. |





## Code Examples
### StyleStateSample
```kotlin
@Composable
fun StyleStateSample() {
    // Create a styleable clickable box
    @Composable
    fun ClickableStyleableBox(
        onClick: () -> Unit,
        modifier: Modifier = Modifier,
        style: Style = Style,
        enabled: Boolean = true,
    ) {
        val interactionSource = remember { MutableInteractionSource() }
        val styleState = rememberUpdatedStyleState(interactionSource) { it.isEnabled = enabled }
        Box(
            modifier =
                modifier
                    .clickable(interactionSource = interactionSource, onClick = onClick)
                    .styleable(styleState, style)
        )
    }
    // Create a 150x150 green box that is clickable
    ClickableStyleableBox(
        onClick = {},
        style = {
            background(Color.Green)
            size(150.dp)
            hovered { background(Color.Yellow) }
            pressed { background(Color.Red) }
            disabled { background(Color.Gray) }
        },
    )
}
```

