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

```kotlin
class PaneExpansionState
internal constructor(
    data: PaneExpansionStateData = PaneExpansionStateData(),
    @get:VisibleForTesting internal val consumeDragDelta: ((Float) -> Float) = noOpConsumeDragDelta,
)
```

This class manages the pane expansion state for pane scaffolds. By providing and modifying an
instance of this class, you can specify the expanded panes' expansion width or proportion when
pane scaffold is displaying a dual-pane layout.

This class also serves as the [DraggableState](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/DraggableState) of pane expansion handle. When a handle
implementation is provided to the associated pane scaffold, the scaffold will use
[PaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionState) to store and manage dragging and anchoring of the handle, and thus the pane
expansion state.

## Properties

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

```kotlin
var currentAnchor
```

The current anchor that pane expansion has been settled or is settling to. Note that this
field might be `null` if:
1. No anchors have been set to the state.
2. Pane expansion is set directly via [setFirstPaneWidth](#setfirstpanewidth) or set [setFirstPaneProportion](#setfirstpaneproportion).
3. Pane expansion is in its initial state without an initial anchor provided.

## Functions

<h2 id="isunspecified">isUnspecified</h2>

```kotlin
fun isUnspecified(): Boolean
```

Returns `true` if none of `firstPaneWidth` or `firstPaneProportion` has been set.

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

<h2 id="setfirstpanewidth-firstpanewidth">setFirstPaneWidth</h2>

```kotlin
fun setFirstPaneWidth(firstPaneWidth: Int)
```

Set the width of the first expanded pane in the layout. When the set value gets applied, it
will be coerced within the range of `[0, the full displayable width of the layout]`.

Note that setting this value will reset the first pane proportion previously set via
[setFirstPaneProportion](#setfirstpaneproportion) or the current dragging result if there's any. Also if user drags
the pane after setting the first pane width, the user dragging result will take the priority
over this set value when rendering panes, but the set value will be saved.

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

<h2 id="setfirstpaneproportion-firstpaneproportion">setFirstPaneProportion</h2>

```kotlin
fun setFirstPaneProportion(@FloatRange(0.0, 1.0) firstPaneProportion: Float)
```

Set the proportion of the first expanded pane in the layout. The set value needs to be within
the range of `[0f, 1f]`, otherwise the setter throws.

Note that setting this value will reset the first pane width previously set via
[setFirstPaneWidth](#setfirstpanewidth) or the current dragging result if there's any. Also if user drags the
pane after setting the first pane proportion, the user dragging result will take the priority
over this set value when rendering panes, but the set value will be saved.

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

<h2 id="animateto-anchor-initialvelocity">animateTo</h2>

```kotlin
suspend fun animateTo(anchor: PaneExpansionAnchor, initialVelocity: Float = 0F)
```

Animate the pane expansion to the given [PaneExpansionAnchor](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneExpansionAnchor). Note that the given anchor
must be one of the provided anchor when creating the state with [rememberPaneExpansionState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/composable-functions/rememberPaneExpansionState);
otherwise the function throws.

#### Parameters

| | |
| --- | --- |
| anchor | the anchor to animate to |
| initialVelocity | the initial velocity of the animation |

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

<h2 id="clear">clear</h2>

```kotlin
fun clear()
```

Clears any previously set `firstPaneWidth` or `firstPaneProportion`, as well as the user
dragging result.

## Companion Object

#### Properties

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

```kotlin
const val Unspecified = -1
```

The constant value used to denote the pane expansion is not specified.