---
title: "performScrollToKey"
description: "Scrolls a scrollable container with keyed items to the item with the given [key], such as
[LazyColumn][androidx.compose.foundation.lazy.LazyColumn] or
[LazyRow][androidx.compose.foundation.lazy.LazyRow].

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 [IndexForKey] or [ScrollToIndex] defined."
type: "function"
---

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


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


```kotlin
fun SemanticsNodeInteraction.performScrollToKey(key: Any): SemanticsNodeInteraction
```


Scrolls a scrollable container with keyed items to the item with the given `key`, such as
`LazyColumn` or
`LazyRow`.

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 `IndexForKey` or `ScrollToIndex` defined.

#### Parameters

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


#### Returns

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




