---
title: "performScrollToIndex"
description: "Scrolls a scrollable container with items to the item with the given [index].

Note that not all scrollable containers have item indices. For example, a
[scrollable][androidx.compose.foundation.gestures.scrollable] doesn't have items with an index,
while [LazyColumn][androidx.compose.foundation.lazy.LazyColumn] does.

This action should be performed on a [node][SemanticsNodeInteraction] that is a scrollable
container, not on a node that is part of the content of that container.

Throws an [AssertionError] if the node doesn't have [ScrollToIndex] defined."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun SemanticsNodeInteraction.performScrollToIndex(index: Int): SemanticsNodeInteraction
```


Scrolls a scrollable container with items to the item with the given `index`.

Note that not all scrollable containers have item indices. For example, a
`scrollable` doesn't have items with an index,
while `LazyColumn` does.

This action should be performed on a `node` that is a scrollable
container, not on a node that is part of the content of that container.

Throws an `AssertionError` if the node doesn't have `ScrollToIndex` defined.

#### Parameters

| | |
| --- | --- |
| index | The index of the item to scroll to |


#### Returns

| | |
| --- | --- |
|  | The `SemanticsNodeInteraction` that is the receiver of this method |




