item

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

Adds a single item to the scope.

Wrapper around LazyGridScope.item.

Parameters

key

a stable and unique key 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

the span of the item. 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

the type of the content of this 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.

content

the content of the item.

See also