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

```kotlin
public sealed interface StackScope
```

Receiver scope used by [VerticalStack](/jetpack-compose/androidx.xr.glimmer/glimmer/components/VerticalStack) that defines a DSL for adding items to the stack.

## Functions

<h2 id="item-key-content">item</h2>

```kotlin
public fun item(key: Any? = null, content: @Composable StackItemScope.() -> Unit)
```

Adds a single item.

#### Parameters

| | |
| --- | --- |
| key | a stable and unique key representing the item. If a key is specified, the scroll position will be maintained based on the key. If items are added/removed before the current visible item, the item with the given key will be kept as the first visible one. If null is passed, the position in the stack will represent the key. |
| content | the content of the item |

<hr class="docs-overload-divider">

<h2 id="items-count-key-itemcontent">items</h2>

```kotlin
public fun items(
        count: Int,
        key: ((index: Int) -> Any)? = null,
        itemContent: @Composable StackItemScope.(Int) -> Unit,
    )
```

Adds a `count` of items.

#### Parameters

| | |
| --- | --- |
| count | the item count |
| key | a factory of stable and unique keys representing the items. If a key is specified, the scroll position will be maintained based on the key. If items are added/removed before the current visible item, the item with the given key will be kept as the first visible one. If null is passed, the position in the stack will represent the key. |
| itemContent | the content displayed by a single item |