# CarouselState

Artifact: [androidx.tv:tv-material](https://developer.android.com/jetpack/androidx/releases/tv) [View Source](https://cs.android.com/search?q=file:androidx/tv/material3/Carousel.kt+class:androidx.tv.material3.CarouselState) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/tv#1.0.0)


```
@ExperimentalTvMaterial3Api
class CarouselState
```

<br />

*** ** * ** ***

State of the Carousel which allows the user to specify the first item that is shown when the Carousel is instantiated in the constructor.

It also provides the user with support to pause and resume the auto-scroll behaviour of the Carousel.

## Summary

| ### Public companion properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/saveable/Saver<https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState, *>` | `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState#Saver()` The default `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState#Saver()` implementation for `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState#CarouselState(kotlin.Int)(initialActiveItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/tv/material3/ScrollPauseHandle` | `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState#pauseAutoScroll(kotlin.Int)(itemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Pauses the auto-scrolling behaviour of Carousel. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState#activeItemIndex()` The index of the item that is currently displayed by the carousel |

## Public companion properties

### Saver

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/tv#1.0.0)

```
val Saver: Saver<CarouselState, *>
```

The default `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState#Saver()` implementation for `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState`.

## Public constructors

### CarouselState

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/tv#1.0.0)

```
CarouselState(initialActiveItemIndex: Int = 0)
```

| Parameters |
|---|---|
| `initialActiveItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the index of the first active item |

## Public functions

### pauseAutoScroll

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/tv#1.0.0)

```
fun pauseAutoScroll(itemIndex: Int): ScrollPauseHandle
```

Pauses the auto-scrolling behaviour of Carousel. The pause request is ignored if `https://developer.android.com/reference/kotlin/androidx/tv/material3/CarouselState#pauseAutoScroll(kotlin.Int)` is not the current item that is visible. Returns a `https://developer.android.com/reference/kotlin/androidx/tv/material3/ScrollPauseHandle` that can be used to resume

## Public properties

### activeItemIndex

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/tv#1.0.0)

```
val activeItemIndex: Int
```

The index of the item that is currently displayed by the carousel