---
title: "rememberCarouselState"
description: "Creates a [CarouselState] that is remembered across compositions.

Changes to the provided initial values will **not** result in the state being recreated or
changed in any way if it has already been created."
type: "composable"
---

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


<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
@ExperimentalTvMaterial3Api
@Composable
fun rememberCarouselState(initialActiveItemIndex: Int = 0): CarouselState
```


Creates a `CarouselState` that is remembered across compositions.

Changes to the provided initial values will **not** result in the state being recreated or
changed in any way if it has already been created.

#### Parameters

| | |
| --- | --- |
| initialActiveItemIndex | the index of the first active item |





