expandableItems

Function

Android
public fun ScalingLazyListScope.expandableItems(
    state: ExpandableState,
    count: Int,
    key: ((index: Int) -> Any)? = null,
    itemContent: @Composable BoxScope.(index: Int) -> Unit,
)

Adds a series of items, that will be expanded/collapsed according to the ExpandableState

Example of an expandable list:

Parameters

stateThe ExpandableState connected to these items.
countThe number of items
keya factory of stable and unique keys representing the item. Using the same key for multiple items in the list is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the list will represent the key. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one.
itemContentthe content displayed by a single item