---
title: "ExpandableStateMapping"
description: "A class that maps from keys of the given type to [ExpandableState]. An instance can be created
and remembered with [rememberExpandableStateMapping]"
type: "class"
---

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


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

<div class='sourceset sourceset-android'>Android</div>


```kotlin
@ExperimentalWearFoundationApi
public class ExpandableStateMapping<T>
internal constructor(
    private val initiallyExpanded: (key: T) -> Boolean,
    private val coroutineScope: CoroutineScope,
    private val expandAnimationSpec: AnimationSpec<Float>,
    private val collapseAnimationSpec: AnimationSpec<Float>,
)
```


A class that maps from keys of the given type to `ExpandableState`. An instance can be created
and remembered with `rememberExpandableStateMapping`


## Functions

```kotlin
public fun getOrPutNew(key: T): ExpandableState
```


Returns the `ExpandableState` for the given key if the value is present and not null.
Otherwise, creates a new one, puts it into the map under the given key and returns it. The
parameters used to create the new `ExpandableState` are the ones passed to
`rememberExpandableStateMapping`



