---
title: "rememberExpandableStateMapping"
description: "Create and [remember] a mapping from keys to [ExpandableState]s [ExpandableState]s can be
requested by key, and we will created with the parameters given here when a mapping didn't exist
before. This is mainly useful when you want to have a variable number of expandables, that can
change at runtime (for example, elements on a ScalingLazyColumn)"
type: "composable"
---

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


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

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


```kotlin
@Composable
@ExperimentalWearFoundationApi
public fun <T> rememberExpandableStateMapping(
    initiallyExpanded: (key: T) -> Boolean = { false },
    expandAnimationSpec: AnimationSpec<Float> = ExpandableItemsDefaults.expandAnimationSpec,
    collapseAnimationSpec: AnimationSpec<Float> = ExpandableItemsDefaults.collapseAnimationSpec,
): ExpandableStateMapping<T>
```


Create and `remember` a mapping from keys to `ExpandableState`s `ExpandableState`s can be
requested by key, and we will created with the parameters given here when a mapping didn't exist
before. This is mainly useful when you want to have a variable number of expandables, that can
change at runtime (for example, elements on a ScalingLazyColumn)

#### Parameters

| | |
| --- | --- |
| initiallyExpanded | A function to compute the initial state given the key. |
| expandAnimationSpec | The `AnimationSpec` to use when showing the extra information. |
| collapseAnimationSpec | The `AnimationSpec` to use when hiding the extra information. |





