<div class='sourceset sourceset-common'>Common</div>

> **Deprecated** This method has been deprecated in favor of the one that accepts a consumeDragDelta.

<h2 id="rememberpaneexpansionstate-keyprovider-anchors-initialanchoredindex-anchoringanimationspec-flingbehavior">rememberPaneExpansionState</h2>

```kotlin
@ExperimentalMaterial3AdaptiveApi
@Composable
fun rememberPaneExpansionState(
    keyProvider: PaneExpansionStateKeyProvider,
    anchors: List<PaneExpansionAnchor> = emptyList(),
    initialAnchoredIndex: Int = -1,
    anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
): PaneExpansionState
```

Remembers and returns a [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) associated to a given
[PaneExpansionStateKeyProvider](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKeyProvider).

Note that the remembered [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) with all keys that have been used will be
persistent through the associated pane scaffold's lifecycles.

#### Parameters

| | |
| --- | --- |
| keyProvider | the provider of [PaneExpansionStateKey](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKey) |
| anchors | the anchor list of the returned [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) |
| initialAnchoredIndex | the index of the anchor that is supposed to be used during the initial layout of the associated scaffold; it has to be a valid index of the provided `anchors` otherwise the function throws; by default the value will be -1 and no initial anchor will be used. |
| anchoringAnimationSpec | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default [ScrollableDefaults.flingBehavior](/jetpack-compose/androidx.compose.foundation/foundation/objects/ScrollableDefaults) will be applied. |

<div class='sourceset sourceset-common'>Common</div>

> **Deprecated** This method has been deprecated in favor of the one that accepts a consumeDragDelta.

<hr class="docs-overload-divider">

<h2 id="rememberpaneexpansionstate-key-anchors-initialanchoredindex-anchoringanimationspec-flingbehavior">rememberPaneExpansionState</h2>

```kotlin
@ExperimentalMaterial3AdaptiveApi
@Composable
fun rememberPaneExpansionState(
    key: PaneExpansionStateKey = PaneExpansionStateKey.Default,
    anchors: List<PaneExpansionAnchor> = emptyList(),
    initialAnchoredIndex: Int = -1,
    anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
): PaneExpansionState
```

Remembers and returns a [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) associated to a given [PaneExpansionStateKey](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKey).

Note that the remembered [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) with all keys that have been used will be
persistent through the associated pane scaffold's lifecycles.

#### Parameters

| | |
| --- | --- |
| key | the key of [PaneExpansionStateKey](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKey) |
| anchors | the anchor list of the returned [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) |
| initialAnchoredIndex | the index of the anchor that is supposed to be used during the initial layout of the associated scaffold; it has to be a valid index of the provided `anchors` otherwise the function throws; by default the value will be -1 and no initial anchor will be used. |
| anchoringAnimationSpec | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default [ScrollableDefaults.flingBehavior](/jetpack-compose/androidx.compose.foundation/foundation/objects/ScrollableDefaults) will be applied. |

<hr class="docs-overload-divider">

<h2 id="rememberpaneexpansionstate-keyprovider-anchors-initialanchoredindex-anchoringanimationspec-flingbehavior-consumedragdelta">rememberPaneExpansionState</h2>

<div class='sourceset sourceset-common'>Common</div>

```kotlin
@ExperimentalMaterial3AdaptiveApi
@Composable
fun rememberPaneExpansionState(
    keyProvider: PaneExpansionStateKeyProvider,
    anchors: List<PaneExpansionAnchor> = emptyList(),
    initialAnchoredIndex: Int = -1,
    anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
    consumeDragDelta: ((delta: Float) -> Float) = PaneExpansionState.noOpConsumeDragDelta,
): PaneExpansionState
```

Remembers and returns a [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) associated to a given
[PaneExpansionStateKeyProvider](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKeyProvider).

Note that the remembered [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) with all keys that have been used will be
persistent through the associated pane scaffold's lifecycles.

#### Parameters

| | |
| --- | --- |
| keyProvider | the provider of [PaneExpansionStateKey](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKey) |
| anchors | the anchor list of the returned [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) |
| initialAnchoredIndex | the index of the anchor that is supposed to be used during the initial layout of the associated scaffold; it has to be a valid index of the provided `anchors` otherwise the function throws; by default the value will be -1 and no initial anchor will be used. |
| anchoringAnimationSpec | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default [ScrollableDefaults.flingBehavior](/jetpack-compose/androidx.compose.foundation/foundation/objects/ScrollableDefaults) will be applied. |
| consumeDragDelta | the callback that will be called before the drag starts to change the pane sizes; the input of the lambda will be the raw delta by user dragging, and it should returns the remaining delta after the consumption by the callback; this can be used to implement custom behavior like nested scrolling or combining pane expansion with other element expansion behavior like navigation rails. |

<hr class="docs-overload-divider">

<h2 id="rememberpaneexpansionstate-key-anchors-initialanchoredindex-anchoringanimationspec-flingbehavior-consumedragdelta">rememberPaneExpansionState</h2>

<div class='sourceset sourceset-common'>Common</div>

```kotlin
@ExperimentalMaterial3AdaptiveApi
@Composable // It's necessary to stabilize the lambda parameter
fun rememberPaneExpansionState(
    key: PaneExpansionStateKey = PaneExpansionStateKey.Default,
    anchors: List<PaneExpansionAnchor> = emptyList(),
    initialAnchoredIndex: Int = -1,
    anchoringAnimationSpec: FiniteAnimationSpec<Float> = DefaultAnchoringAnimationSpec,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
    consumeDragDelta: ((Float) -> Float) = PaneExpansionState.noOpConsumeDragDelta,
): PaneExpansionState
```

Remembers and returns a [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) associated to a given [PaneExpansionStateKey](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKey).

Note that the remembered [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) with all keys that have been used will be
persistent through the associated pane scaffold's lifecycles.

#### Parameters

| | |
| --- | --- |
| key | the key of [PaneExpansionStateKey](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/interfaces/PaneExpansionStateKey) |
| anchors | the anchor list of the returned [PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) |
| initialAnchoredIndex | the index of the anchor that is supposed to be used during the initial layout of the associated scaffold; it has to be a valid index of the provided `anchors` otherwise the function throws; by default the value will be -1 and no initial anchor will be used. |
| anchoringAnimationSpec | the animation spec used to perform anchoring animation; by default it will be a spring motion. |
| flingBehavior | the fling behavior used to handle flings; by default [ScrollableDefaults.flingBehavior](/jetpack-compose/androidx.compose.foundation/foundation/objects/ScrollableDefaults) will be applied. |
| consumeDragDelta | the callback that will be called before the drag starts to change the pane sizes; the input of the lambda will be the raw delta by user dragging, and it should returns the remaining delta after the consumption by the callback; this can be used to implement custom behavior like nested scrolling or combining pane expansion with other element expansion behavior like navigation rails. |