items

abstract fun items(key: (item: Item) -> Any? = null, span: LazyGridItemSpanScope.(item: Item) -> GridItemSpan? = null, contentType: (item: Item) -> Any? = { null }, itemContent: @Composable LazyDragSelectGridItemScope<Item>.(item: Item) -> Unit)

Adds a list of items from the Items in the scope.

Wrapper around LazyGridScope.items.

Parameters

key

a factory of stable and unique keys representing the item. Using the same key for multiple items in the grid is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the grid 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.

span

define custom spans for the items. Default is 1x1. It is good practice to leave it null when this matches the intended behavior, as providing a custom implementation impacts performance.

contentType

a factory of the content types for the item. The item compositions of the same type could be reused more efficiently. Note that null is a valid type and items of such type will be considered compatible.

itemContent

the content displayed by a single item.

See also