# rememberExpandableStateMapping

## Functions summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/ExpandableStateMapping<T>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable @https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/ExperimentalWearFoundationApi <T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/rememberExpandableStateMapping.composable#rememberExpandableStateMapping(kotlin.Function1,androidx.compose.animation.core.AnimationSpec,androidx.compose.animation.core.AnimationSpec)( initiallyExpanded: (key) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, expandAnimationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>, collapseAnimationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html> )` Create and `https://developer.android.com/reference/kotlin/androidx/compose/runtime/remember.composable#remember(kotlin.Function0)` a mapping from keys to `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/ExpandableState`s. |

## Functions

### rememberExpandableStateMapping

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/Expandable.kt+function:rememberExpandableStateMapping) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)

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

Create and `https://developer.android.com/reference/kotlin/androidx/compose/runtime/remember.composable#remember(kotlin.Function0)` a mapping from keys to `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/ExpandableState`s. `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/ExpandableState`s can be requested by key, and will be 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: (key) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = { false }` | A function to compute the initial state given the key. |
| `expandAnimationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html> = ExpandableItemsDefaults.expandAnimationSpec` | The `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` to use when showing the extra information. |
| `collapseAnimationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html> = ExpandableItemsDefaults.collapseAnimationSpec` | The `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` to use when hiding the extra information. |