---
title: "scrollToItem"
type: "function"
---
## API Reference

### scrollToItem

> Source set: Common

```kotlin
override suspend fun scrollToItem(index: Int)
```

### scrollToItem

> Source set: Common

```kotlin
public suspend fun scrollToItem(@AndroidXIntRange(from = 0) index: Int, scrollOffset: Int = 0)
```

Instantly brings the item at `index` to the top of the viewport, offset by [scrollOffset](/jetpack-compose/androidx.compose.foundation/foundation/properties/scrollOffset/api)
pixels.

#### Parameters

| | |
| --- | --- |
| index | the index to which to scroll. Must be non-negative. |
| scrollOffset | the offset that the item should end up after the scroll. Note that positive offset refers to forward scroll, so in a top-to-bottom list, positive offset will scroll the item further upward (taking it partly offscreen). |
