---
title: "scrollToIndex"
description: "Action to scroll a container to the index of one of its items.

The [action] should throw an [IllegalArgumentException] if the index is out of bounds."
type: "function"
---

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


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


```kotlin
fun SemanticsPropertyReceiver.scrollToIndex(label: String? = null, action: (Int) -> Boolean)
```


Action to scroll a container to the index of one of its items.

The `action` should throw an `IllegalArgumentException` if the index is out of bounds.



